2015-04-25 21:23:34 +03:00
|
|
|
:: digital ocean fleet management
|
|
|
|
::
|
|
|
|
::::
|
|
|
|
::
|
|
|
|
/? 310
|
|
|
|
::
|
|
|
|
::
|
|
|
|
:::: sivtyv-barnel
|
|
|
|
::
|
|
|
|
|
|
|
|
!:
|
|
|
|
|%
|
2015-04-30 00:02:54 +03:00
|
|
|
++ droplet
|
|
|
|
$: id=@ name=@t memory=@ud vcpus=@ud disk=@ud locked=?
|
|
|
|
created=@t status=@t backup-ids=(list ,@t) snapshot-ids=(list ,@t)
|
|
|
|
features=(list ,@t) region=[name=@t slug=@t sizes=(list ,@t)] image=img size=json
|
|
|
|
size-slug=@t networks=ntwrks kernel=json next-backup-window=json
|
|
|
|
==
|
|
|
|
++ kern ,~
|
|
|
|
++ img
|
|
|
|
$: id=@ud name=@t distribution=@t slug=@t public=? regions=(list ,@t)
|
|
|
|
created-at=@t type=@t min-disk-size=@ud
|
|
|
|
==
|
|
|
|
++ ntwrks ,[v4=v v6=v]
|
|
|
|
++ v ,[ip-address=@t netmask=@t gateway=@t type=@t]
|
|
|
|
++ regn ,~
|
|
|
|
++ axle ,[ke=keys toke=tokens drops=droplet]
|
2015-04-25 21:23:34 +03:00
|
|
|
++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)]
|
|
|
|
++ tokens ,[access=@t refresh=@t]
|
|
|
|
++ move ,[bone (mold note gift)]
|
|
|
|
++ note
|
|
|
|
$: %e
|
|
|
|
%them
|
|
|
|
(unit hiss)
|
|
|
|
==
|
|
|
|
++ gift
|
|
|
|
$% [%nice ~]
|
|
|
|
[%rush %json json]
|
|
|
|
==
|
|
|
|
++ sign
|
|
|
|
$: %e
|
|
|
|
$% [%thou p=httr]
|
|
|
|
== ==
|
2015-04-30 00:02:54 +03:00
|
|
|
--
|
2015-04-25 21:23:34 +03:00
|
|
|
|
2015-04-30 00:02:54 +03:00
|
|
|
|%
|
|
|
|
++ parse-id
|
|
|
|
=> jo
|
|
|
|
%- ot :~ id/ni name/so distribution/so slug/so public/bo
|
|
|
|
regions/(ar so) created-at/so type/so min-disk-size/ni
|
|
|
|
==
|
|
|
|
++ parse-ntwrks
|
|
|
|
=> jo
|
|
|
|
%- ot
|
|
|
|
:+ v4/(ot ip-address/so netmask/so gateway/so type/so ~)
|
|
|
|
v6/(ot ip-address/so netmask/so gateway/so type/so ~)
|
|
|
|
~
|
2015-04-25 21:23:34 +03:00
|
|
|
--
|
|
|
|
!:
|
|
|
|
|_ [hid=hide vat=axle]
|
2015-04-30 00:02:54 +03:00
|
|
|
::
|
|
|
|
++ receive-list
|
|
|
|
|= [ost=bone pour-path=path resp=sign]
|
|
|
|
~& resp
|
|
|
|
=+ parsed=(rash q:(need r.p.+.resp) apex:poja)
|
|
|
|
=+ dar=(need ((ot droplets/(ar some) ~):jo parsed))
|
|
|
|
=+ ^- drop=droplet
|
|
|
|
~| 'bad json'
|
|
|
|
%- need
|
|
|
|
%. `json`-.dar =+ jo
|
|
|
|
%^ ot id/ni name/so
|
|
|
|
:^ memory/ni vcpus/ni disk/ni
|
|
|
|
:^ locked/bo 'created_at'^so status/so
|
|
|
|
:^ 'backup_ids'^(ar so) 'snapshot_ids'^(ar so) features/(ar so)
|
|
|
|
:^ region/(ot name/so slug/so sizes/(ar so) ~) image/parse-id size/some
|
|
|
|
:^ 'size_slug'^so networks/parse-ntwrks kernel/some ::(ot id/ni name/so version/so ~)
|
|
|
|
:- 'next_backup_window'^some ~
|
|
|
|
~& drop
|
|
|
|
:_ +>.$
|
|
|
|
[ost %give %nice ~]~
|
|
|
|
::
|
2015-04-25 21:23:34 +03:00
|
|
|
++ auth-queries
|
|
|
|
:~ 'grant_type'^'authorization_code'
|
|
|
|
'code'^(need authc.ke.vat)
|
|
|
|
:- 'client_id'
|
|
|
|
'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f'
|
|
|
|
'redirect_uri'^'http://localhost:8443/main/pub/do/fab'
|
|
|
|
==
|
|
|
|
++ httpreq
|
|
|
|
|= $: ost=bone pour-path=wire
|
|
|
|
domain=(list cord) end-point=path
|
|
|
|
req-type=$?(%get %post) headers=math
|
|
|
|
queries=quay
|
|
|
|
==
|
|
|
|
^- move
|
|
|
|
=+ ^- parsed-url=purl
|
|
|
|
:+ ^= host-port :: ++hart
|
|
|
|
:+ security=%.y
|
|
|
|
port=~
|
|
|
|
host=[%.y [path=[%com domain]]]
|
|
|
|
endpoint=[extensions=~ point=end-point] :: ++pork,
|
|
|
|
q-strings=queries :: ++quay
|
|
|
|
=+ ^- request=hiss :: cast to hiss
|
|
|
|
:- parsed-url
|
|
|
|
[req-type headers ~] :: post
|
|
|
|
:^ ost %pass pour-path
|
|
|
|
:+ %e %them
|
|
|
|
`(unit hiss)`[~ request]
|
|
|
|
++ prep ,_`. :: wipe state when app code is changed
|
|
|
|
::
|
|
|
|
++ peer
|
|
|
|
|= [ost=bone you=ship pax=path]
|
|
|
|
^- [(list move) _+>.$]
|
|
|
|
:_ +>.$
|
|
|
|
[ost %give %rush %json ~]~
|
|
|
|
::
|
|
|
|
++ poke-oauth2-code
|
|
|
|
|= [ost=bone you=ship code=cord]
|
|
|
|
^- [(list move) _+>.$]
|
|
|
|
=. authc.ke.vat
|
|
|
|
[~ code]
|
|
|
|
=+ ath=(need authc.ke.vat)
|
|
|
|
:_ +>.$
|
|
|
|
[ost %give %nice ~]~
|
|
|
|
::
|
|
|
|
++ poke-client-secret
|
|
|
|
|= [ost=bone you=ship secret=cord]
|
|
|
|
^- [(list move) _+>.$]
|
|
|
|
=. client-secret.ke.vat
|
|
|
|
[~ secret]
|
|
|
|
~& client-secret.ke.vat
|
|
|
|
:_ +>.$
|
|
|
|
:_ [ost %give %nice ~]~
|
|
|
|
%^ httpreq ost /auth
|
|
|
|
:^ ~[%digitalocean %cloud] `path`/v1/oauth/token
|
|
|
|
%post
|
|
|
|
:- ~ `quay`['client_secret'^(need client-secret.ke.vat) auth-queries]
|
|
|
|
::
|
2015-04-30 00:02:54 +03:00
|
|
|
++ receive-auth
|
2015-04-25 21:23:34 +03:00
|
|
|
|= [ost=bone pour-path=path resp=sign]
|
2015-04-30 00:02:54 +03:00
|
|
|
=+ body=(rash q:(need r.p.+.resp) apex:poja)
|
|
|
|
~& body
|
|
|
|
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
|
|
|
=: access.toke.vat ac
|
|
|
|
refresh.toke.vat re
|
|
|
|
==
|
|
|
|
~& toke.vat
|
|
|
|
:_ +>.$
|
|
|
|
[ost %give %nice ~]~
|
|
|
|
::
|
|
|
|
++ poke-json
|
|
|
|
|= [ost=bone you=ship act=json]
|
|
|
|
=+ do=(need (so:jo act))
|
|
|
|
?+ do !!
|
|
|
|
%list
|
|
|
|
:_ +>.$
|
|
|
|
:+ [(list-droplets ost)]
|
|
|
|
[ost %give %nice ~]
|
|
|
|
~
|
|
|
|
%suth-else
|
|
|
|
:_ +>.$
|
|
|
|
[ost %give %nice ~]~
|
2015-04-25 21:23:34 +03:00
|
|
|
==
|
2015-04-30 00:02:54 +03:00
|
|
|
::
|
2015-04-25 21:23:34 +03:00
|
|
|
++ list-droplets
|
|
|
|
|= os=bone
|
|
|
|
=+ ^= lis :*
|
|
|
|
os /list
|
|
|
|
~[%digitalocean %api] /v2/droplets
|
|
|
|
%get
|
|
|
|
(mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~)
|
|
|
|
~
|
|
|
|
==
|
|
|
|
(httpreq lis)
|
2015-04-30 00:02:54 +03:00
|
|
|
::
|
|
|
|
++ pour
|
|
|
|
|= [ost=bone pour-path=path resp=sign]
|
|
|
|
^- [(list move) _+>.$]
|
|
|
|
?+ -.pour-path !!
|
|
|
|
%auth
|
|
|
|
(receive-auth ost pour-path resp)
|
|
|
|
::
|
|
|
|
%list
|
|
|
|
(receive-list ost pour-path resp)
|
|
|
|
==
|
2015-04-25 21:23:34 +03:00
|
|
|
--
|