mirror of
https://github.com/urbit/shrub.git
synced 2025-01-06 04:07:23 +03:00
do app
This commit is contained in:
parent
13dc51c80c
commit
c53723140a
@ -7,15 +7,26 @@
|
|||||||
::
|
::
|
||||||
:::: sivtyv-barnel
|
:::: sivtyv-barnel
|
||||||
::
|
::
|
||||||
::id=@ud name=@t memory=@ud vcpu=@ud disk=@ud locked=@f created=@t status=@t backup-ids=json snapshot-ids=json features=json region=json image=json size=json size-slug=@t networks=json kernel=json next-backup-window=@t])
|
|
||||||
|
|
||||||
!:
|
!:
|
||||||
|%
|
|%
|
||||||
++ droplet ,~
|
++ droplet
|
||||||
++ axle ,[ke=keys toke=tokens drops=(list 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]
|
||||||
++ 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]
|
||||||
++ droplet (unit ,@)
|
|
||||||
++ move ,[bone (mold note gift)]
|
++ move ,[bone (mold note gift)]
|
||||||
++ note
|
++ note
|
||||||
$: %e
|
$: %e
|
||||||
@ -30,11 +41,44 @@ $% [%nice ~]
|
|||||||
$: %e
|
$: %e
|
||||||
$% [%thou p=httr]
|
$% [%thou p=httr]
|
||||||
== ==
|
== ==
|
||||||
|
--
|
||||||
|
|
||||||
|
|%
|
||||||
|
++ 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 ~)
|
||||||
|
~
|
||||||
--
|
--
|
||||||
!:
|
!:
|
||||||
|_ [hid=hide vat=axle]
|
|_ [hid=hide vat=axle]
|
||||||
|
::
|
||||||
|
++ 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 ~]~
|
||||||
|
::
|
||||||
++ auth-queries
|
++ auth-queries
|
||||||
:~ 'grant_type'^'authorization_code'
|
:~ 'grant_type'^'authorization_code'
|
||||||
'code'^(need authc.ke.vat)
|
'code'^(need authc.ke.vat)
|
||||||
@ -82,7 +126,6 @@ $% [%thou p=httr]
|
|||||||
++ poke-client-secret
|
++ poke-client-secret
|
||||||
|= [ost=bone you=ship secret=cord]
|
|= [ost=bone you=ship secret=cord]
|
||||||
^- [(list move) _+>.$]
|
^- [(list move) _+>.$]
|
||||||
~& 'pokeclientsecret'
|
|
||||||
=. client-secret.ke.vat
|
=. client-secret.ke.vat
|
||||||
[~ secret]
|
[~ secret]
|
||||||
~& client-secret.ke.vat
|
~& client-secret.ke.vat
|
||||||
@ -93,28 +136,32 @@ $% [%thou p=httr]
|
|||||||
%post
|
%post
|
||||||
:- ~ `quay`['client_secret'^(need client-secret.ke.vat) auth-queries]
|
:- ~ `quay`['client_secret'^(need client-secret.ke.vat) auth-queries]
|
||||||
::
|
::
|
||||||
++ pour
|
++ receive-auth
|
||||||
|= [ost=bone pour-path=path resp=sign]
|
|= [ost=bone pour-path=path resp=sign]
|
||||||
^- [(list move) _+>.$]
|
=+ body=(rash q:(need r.p.+.resp) apex:poja)
|
||||||
?+ -.pour-path !!
|
~& body
|
||||||
%auth
|
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
||||||
=+ body=(rash q:(need r.p.+.resp) apex:poja)
|
=: access.toke.vat ac
|
||||||
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
refresh.toke.vat re
|
||||||
=: access.toke.vat ac
|
==
|
||||||
refresh.toke.vat re
|
~& toke.vat
|
||||||
==
|
:_ +>.$
|
||||||
~& toke.vat
|
[ost %give %nice ~]~
|
||||||
:_ +>.$
|
::
|
||||||
:- [ost %give %nice ~]
|
++ poke-json
|
||||||
[(list-droplets ost)]~
|
|= [ost=bone you=ship act=json]
|
||||||
::
|
=+ do=(need (so:jo act))
|
||||||
%list
|
?+ do !!
|
||||||
:_ +>.$
|
%list
|
||||||
=+ parsed=(rash q:(need r.p.+.resp) apex:poja)
|
:_ +>.$
|
||||||
=+ dar=((ot droplets/(ar some) ~):jo parsed)
|
:+ [(list-droplets ost)]
|
||||||
~& [dar/dar]
|
[ost %give %nice ~]
|
||||||
[ost %give %nice ~]~
|
~
|
||||||
|
%suth-else
|
||||||
|
:_ +>.$
|
||||||
|
[ost %give %nice ~]~
|
||||||
==
|
==
|
||||||
|
::
|
||||||
++ list-droplets
|
++ list-droplets
|
||||||
|= os=bone
|
|= os=bone
|
||||||
=+ ^= lis :*
|
=+ ^= lis :*
|
||||||
@ -125,4 +172,15 @@ $% [%thou p=httr]
|
|||||||
~
|
~
|
||||||
==
|
==
|
||||||
(httpreq lis)
|
(httpreq lis)
|
||||||
|
::
|
||||||
|
++ 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)
|
||||||
|
==
|
||||||
--
|
--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
::
|
::
|
||||||
::::
|
::::
|
||||||
::
|
:::
|
||||||
/? 310
|
/? 310
|
||||||
/= gas /$ fuel
|
/= gas /$ fuel
|
||||||
::
|
::
|
||||||
|
@ -23,6 +23,12 @@ Page = recl({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getList: function(){
|
||||||
|
urb.send({appl: "do",
|
||||||
|
data: "list",
|
||||||
|
mark: "json"})
|
||||||
|
},
|
||||||
|
|
||||||
render: function(){
|
render: function(){
|
||||||
href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fmain%2Fpub%2Fdo%2Ffab&response_type=code&redirect_uri=http://localhost:8443/main/pub/do/fab&scope=read+write"
|
href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fmain%2Fpub%2Fdo%2Ffab&response_type=code&redirect_uri=http://localhost:8443/main/pub/do/fab&scope=read+write"
|
||||||
return (div({}, [
|
return (div({}, [
|
||||||
@ -35,7 +41,8 @@ Page = recl({
|
|||||||
div({}, [
|
div({}, [
|
||||||
input({id:"appsecret"},
|
input({id:"appsecret"},
|
||||||
b({onClick:this.sendSecret}, "Send Secret"))
|
b({onClick:this.sendSecret}, "Send Secret"))
|
||||||
])
|
]),
|
||||||
|
b({onClick:this.getList}, "Get List")
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user