urbit/pkg/landscape/lib/s3-json.hoon

51 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-04-23 23:53:00 +03:00
/- *s3
|%
++ json-to-action
|= =json
^- action
=, format
2020-04-23 23:53:00 +03:00
|^ (parse-json json)
++ parse-json
%- of:dejs
:~ [%set-endpoint so:dejs]
[%set-access-key-id so:dejs]
[%set-secret-access-key so:dejs]
[%add-bucket so:dejs]
[%remove-bucket so:dejs]
[%set-current-bucket so:dejs]
==
2020-04-23 23:53:00 +03:00
--
::
++ update-to-json
|= upd=update
^- json
=, format
%+ frond:enjs %s3-update
%- pairs:enjs
2020-04-23 23:53:00 +03:00
:~ ?- -.upd
2020-04-24 02:49:14 +03:00
%set-current-bucket [%'setCurrentBucket' s+bucket.upd]
%add-bucket [%'addBucket' s+bucket.upd]
%remove-bucket [%'removeBucket' s+bucket.upd]
%set-endpoint [%'setEndpoint' s+endpoint.upd]
%set-access-key-id [%'setAccessKeyId' s+access-key-id.upd]
%set-secret-access-key
2020-04-24 02:49:14 +03:00
[%'setSecretAccessKey' s+secret-access-key.upd]
::
2020-04-23 23:53:00 +03:00
%credentials
:- %credentials
%- pairs:enjs
:~ [%endpoint s+endpoint.credentials.upd]
2020-04-24 02:49:14 +03:00
[%'accessKeyId' s+access-key-id.credentials.upd]
[%'secretAccessKey' s+secret-access-key.credentials.upd]
==
::
%configuration
:- %configuration
%- pairs:enjs
:~ [%buckets a+(turn ~(tap in buckets.configuration.upd) |=(a=@t s+a))]
2020-04-24 02:49:14 +03:00
[%'currentBucket' s+current-bucket.configuration.upd]
==
2020-04-23 23:53:00 +03:00
==
==
--