small updates

This commit is contained in:
Henry Ault 2015-05-13 06:14:36 -07:00
parent 552d388e17
commit a9e358a759
2 changed files with 116 additions and 65 deletions

View File

@ -2,17 +2,20 @@
:: ::
:::: ::::
:: ::
/? 310 /? 314
/- *talk
/+ talk, sole, http
:: ::
:: ::
:::: sivtyv-barnel :::: sivtyv-barnels
:: ::
!: !:
|% |%
++ droplet ++ droplet
$: id=@ud name=@t memory=@ud vcpus=@ud disk=@ud locked=? $: id=@ud name=@t memory=@ud vcpus=@ud disk=@ud locked=?
created=@t status=@t backup-ids=(list ,@t) snapshot-ids=(list ,@t) created=@t status=@t backup-ids=(list ,@t) snapshot-ids=(list ,@ud)
features=(list ,@t) region=regi image=img features=(list ,@t) region=regi image=img
size=syze size-slug=@t networks=ntwrks kernel=kern size=syze size-slug=@t networks=ntwrks kernel=kern
next-backup-window=json next-backup-window=json
@ -31,26 +34,30 @@ $: memory=@ud price-monthly=@t price-hourly=@t disk=@ud vcpus=@ud
== ==
++ reqbody ++ reqbody
$: $:
name=@t region=@t size=@t image=@t ssh=(list cord) name=@t region=@t size=@t image=@ud ssh=(list cord)
backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t) backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t)
== ==
++ axle ,[ke=keys toke=tokens drops=(list droplet)] ++ axle ,[ke=keys toke=tokens drops=(list droplet)]
++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)] ++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)]
++ tokens ,[access=@t refresh=@t] ++ tokens ,[access=@t refresh=@t]
++ hapt ,[ship path]
++ move ,[bone (mold note gift)] ++ move ,[bone (mold note gift)]
++ note ++ note
$: %e $%
%them [%t %wait @da]
(unit hiss) [%g %mess hapt ship cage]
== [%e %them (unit hiss)]
==
++ gift ++ gift
$% [%nice ~] $% [%nice ~]
[%rush %json json] [%rush %json json]
== ==
++ sign ++ sign
$: %e $%
$% [%thou p=httr] [%t %wake ~]
== == [%g %nice ~]
[%e %thou p=httr]
==
-- --
!: !:
|% ::: |% :::
@ -76,12 +83,12 @@ $% [%thou p=httr]
=> jo => jo
(ot name/so slug/so sizes/(ar so) ~) (ot name/so slug/so sizes/(ar so) ~)
++ create-body ++ create-body
|= $: name=@t region=@t size=@t image=@t ssh-keys=(list cord) |= $: name=@t region=@t size=@t image=@ud ssh-keys=(list cord)
backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t) backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t)
== ==
%- jobe %- jobe
:~ name/s/name region/s/region size/s/size image/s/image :~ name/s/name region/s/region size/s/size image/(jone image) ::(jone image)
'ssh_keys'^a/(turn ssh-keys |=(cord s/+<)) backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6) backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6)
'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking) 'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking)
== ==
++ state-to-json ++ state-to-json
@ -99,7 +106,7 @@ $% [%thou p=httr]
created/s/created created/s/created
status/s/status status/s/status
backup-ids/a/(turn backup-ids |=(el=cord s/el)) backup-ids/a/(turn backup-ids |=(el=cord s/el))
snapshot-ids/a/(turn snapshot-ids |=(el=cord s/el)) snapshot-ids/a/(turn snapshot-ids jone)
features/a/(turn features |=(el=cord s/el)) features/a/(turn features |=(el=cord s/el))
=+ ^= reg =+ ^= reg
:~ name/s/name.region slug/s/slug.region :~ name/s/name.region slug/s/slug.region
@ -140,12 +147,20 @@ $% [%thou p=httr]
!: !:
|_ [hid=hide vat=axle] |_ [hid=hide vat=axle]
:: ::
++ auth-queries ++ prep ,_`.
:::
++ spam
|= jon=json
%+ turn (~(tap by sup.hid))
|= [sub=bone @ pax=path]
^- move
[sub %give %rush %json jon]
++ auth-queries
:~ 'grant_type'^'authorization_code' :~ 'grant_type'^'authorization_code'
'code'^(need authc.ke.vat) 'code'^(need authc.ke.vat)
:- 'client_id' :- 'client_id'
'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f' 'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f'
'redirect_uri'^'http://localhost:8443/main/pub/do/fab' 'redirect_uri'^'http://localhost:8443/home/pub/do/fab'
== ==
++ httpreq ++ httpreq
|= $: ost=bone pour-path=wire |= $: ost=bone pour-path=wire
@ -169,7 +184,6 @@ $% [%thou p=httr]
:^ ost %pass pour-path :^ ost %pass pour-path
:+ %e %them :+ %e %them
`(unit hiss)`[~ request] `(unit hiss)`[~ request]
::++ prep ,_`. :: wipe state when app code is changed
:: ::
++ peer ++ peer
|= [ost=bone you=ship pax=path] |= [ost=bone you=ship pax=path]
@ -191,7 +205,7 @@ $% [%thou p=httr]
^- [(list move) _+>.$] ^- [(list move) _+>.$]
=. client-secret.ke.vat =. client-secret.ke.vat
[~ secret] [~ secret]
~& client-secret.ke.vat ~& [secret=client-secret.ke.vat code=authc.ke.vat]
:_ +>.$ :_ +>.$
:_ [ost %give %nice ~]~ :_ [ost %give %nice ~]~
%^ httpreq ost /auth %^ httpreq ost /auth
@ -201,77 +215,88 @@ $% [%thou p=httr]
:: ::
++ receive-auth ++ receive-auth
|= [ost=bone pour-path=path resp=sign] |= [ost=bone pour-path=path resp=sign]
^- [(list move) _+>.$]
?> ?=(%thou +<.resp)
~| resp
=+ body=(rash q:(need r.p.+.resp) apex:poja) =+ body=(rash q:(need r.p.+.resp) apex:poja)
~& body ~| recieve-auth/resp(r.p.+ body)
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body)) =+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
=: access.toke.vat ac =: access.toke.vat ac
refresh.toke.vat re refresh.toke.vat re
== ==
~& toke.vat
:_ +>.$ :_ +>.$
[ost %give %nice ~]~ :~ (list-droplets ost)
(publish ost our.hid [%lin & 'successfully authenticated']~)
==
:: ::
++ poke-json ++ poke-json
|= [ost=bone you=ship act=json] |= [ost=bone you=ship act=json]
^- [(list move) _+>.$] ^- [(list move) _+>.$]
=+ do=(need ((ot action/so ~):jo act)) =+ do=(need ((ot action/so ~):jo act))
?+ do !! ?+ do !!
%list %list
:_ +>.$ :_ +>.$
:+ [(list-droplets ost)] :- (list-droplets ost)
[ost %give %nice ~] [ost %give %nice ~]~
~ ::
%create %create
:_ +>.$ :_ +>.$
=+ ^- deets=reqbody =+ ^- deets=reqbody
%- need %- need
%. act %. act
=> jo => jo
%- ot %- ot
:~ name/so region/so size/so image/so ssh/(ar so) backups/(mu bo) :~ name/so region/so size/so image/(su dem) ssh/(ar so) backups/(mu bo)
'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so) 'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so)
== ==
:+ [(create-droplet ost deets)] :- (create-droplet ost deets)
[ost %give %nice ~] [ost %give %nice ~]~
~ ::
%reboot $? %reboot %'power_cycle' %shutdown %'power_off' %'power_on'
:_ +>.$ %'password_reset' %'enable_ipv6' %'enable_private_networking'
=+ id=(need ((ot id/ni ~):jo act)) %snapshot %upgrade
~& id ==
^- (list move) =+ id=(need ((ot id/no ~):jo act))
:+ `move`(reboot-droplet ost id) (droplet-action ost id do)
[ost %give %nice ~]
~
== ==
::
++ reboot-droplet ++ droplet-action
|= [os=bone id=@ud] |= $: os=bone id=@t
$= action $?
%delete %reboot %'power_cycle' %shutdown %'power_off'
%'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking'
%snapshot %upgrade :: add retrieve droplet action
== ==
:: restore, resize, rebuild, change_kernelm, retrieve droplet action
:_ +>.$
^- (list move)
:_ [os %give %nice ~]~
=+ ^= req
%- httpreq :* %- httpreq :*
os os /reboot
/reboot ~[%digitalocean %api] /v2/droplets/[id]/actions
~[%digitalocean %api] [%post `json`(jobe type/s/action ~)]
=+ path=`path`/v2/droplets/'5073686'/actions
~& path
path
[%post `json`(jobe type/s/'reboot' ~)]
(mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~) (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~)
*quay *quay
== ==
req
++ list-droplets ++ list-droplets
|= os=bone |= os=bone
~& 'poked'
=+ ^= lis =+ ^= lis
:~ os /list :~ os /list
~[%digitalocean %api] /v2/droplets ~[%digitalocean %api] /v2/droplets
%get %get
(mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~) (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~)
== ==
(httpreq lis) (httpreq lis)
:: ::
++ receive-list ++ receive-list
|= [ost=bone pour-path=path resp=sign] |= [ost=bone pour-path=path resp=sign]
^- [(list move) _+>.$]
?> ?=(%thou +<.resp)
=+ parsed=(rash q:(need r.p.+.resp) apex:poja) =+ parsed=(rash q:(need r.p.+.resp) apex:poja)
~| recieve-list/parsed
=+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) =+ dar=(need ((ot droplets/(ar some) ~):jo parsed))
=+ ^- dropz=(list droplet) =+ ^- dropz=(list droplet)
~| bad-json/-.dar ~| bad-json/-.dar
@ -283,20 +308,20 @@ $% [%thou p=httr]
:~ id/ni name/so :~ id/ni name/so
memory/ni vcpus/ni disk/ni memory/ni vcpus/ni disk/ni
locked/bo 'created_at'^so status/so locked/bo 'created_at'^so status/so
'backup_ids'^(ar so) 'snapshot_ids'^(ar so) features/(ar so) 'backup_ids'^(ar so) 'snapshot_ids'^(ar ni) features/(ar so)
region/parse-region image/parse-img size/parse-size region/parse-region image/parse-img size/parse-size
'size_slug'^so networks/parse-ntwrks kernel/(ot id/ni name/so version/so ~) 'size_slug'^so networks/parse-ntwrks kernel/(ot id/ni name/so version/so ~)
'next_backup_window'^some 'next_backup_window'^some
== ==
=. drops.vat =. drops.vat
dropz dropz
~& drops/drops.vat =+ buf=`@da`(add ~s10 lat.hid)
:_ +>.$ :_ +>.$
[ost %give %nice ~]~ :_ (spam (state-to-json drops.vat))
[ost %pass /refresh %t [%wait p=buf]]
:: ::
++ create-droplet ++ create-droplet
|= [os=bone reqbody] |= [os=bone reqbody]
~& 'reached'
=+ ^= create :* =+ ^= create :*
os /create os /create
~[%digitalocean %api] /v2/droplets ~[%digitalocean %api] /v2/droplets
@ -309,26 +334,52 @@ $% [%thou p=httr]
['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~ ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~
~ ~
== ==
(httpreq create) ~& (httpreq create)
(httpreq create)
:: ::
++ pour ++ pour
|= [ost=bone pour-path=path resp=sign] |= [ost=bone pour-path=path resp=sign]
^- [(list move) _+>.$] ^- [(list move) _+>.$]
?+ -.pour-path !! ?+ -.pour-path !!
%auth %auth
(receive-auth ost pour-path resp) (receive-auth `bone`ost `path`pour-path `sign`resp)
:: ::
%list %list
(receive-list ost pour-path resp) (receive-list ost pour-path resp)
:: ::
$?
%delete %reboot %'power_cycle' %shutdown %'power_off'
%'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking'
%snapshot %upgrade :: add retrieve droplet action
%create %create
~& created/resp ==
:_ +>.$ ~& resp
[ost %give %nice ~]~ :_ +>.$ ~
:: ::
%reboot %pub
~& resp :_ +>.$ ~
::
%refresh
:_ +>.$ :_ +>.$
[ost %give %nice ~]~ [(list-droplets ost)]~
== ==
++ publish
|= [ost=bone you=ship act=(list speech)]
^- move
=+ ^= spchz
%+ turn act
|= sp=speech
=+ ^= tail
:- ^- audience
:+ :- `partner`[%& our.hid ?+((clan our.hid) !! %czar %court, %duke %porch)]
^- (pair envelope delivery)
[`envelope`[& ~] %pending]
~
~
`statement`[lat.hid ~ sp]
^- thought
:- `@`(sham eny.hid tail)
tail
=+ cag=`cage`[%talk-command !>([%publish `(list thought)`spchz])]
[ost %pass /pub %g %mess [our.hid /talk] you cag]
-- --

View File

@ -80,7 +80,7 @@ Page = recl({
region:$('#region').val(), region:$('#region').val(),
size:$('#size').val(), size:$('#size').val(),
image:$('#image').val(), image:$('#image').val(),
ssh:[$('#ssh').val()], ssh:[] // $('#ssh').val()],
backups:null,//$('#backups').val(), backups:null,//$('#backups').val(),
ipv6:null,//$('#ipv6').val(), ipv6:null,//$('#ipv6').val(),
priv_networking:null,//$('#priv-networking').val(), priv_networking:null,//$('#priv-networking').val(),