keys
Creates, updates, deletes, gets or lists a keys
resource.
Overview
Name | keys |
Type | Resource |
Id | digitalocean.spaces.keys |
Fields
The following fields are returned by SELECT
queries:
- spaces_key_get
- spaces_key_list
A JSON response containing details about the key.
Name | Datatype | Description |
---|---|---|
name | string | The access key's name. (example: my-access-key) |
access_key | string | The Access Key ID used to access a bucket. (example: DOACCESSKEYEXAMPLE) |
created_at | string (date-time) | The date and time the key was created. (example: 2018-07-19T15:04:16Z) |
grants | array | The list of permissions for the access key. |
A JSON response containing a list of keys.
Name | Datatype | Description |
---|---|---|
name | string | The access key's name. (example: my-access-key) |
access_key | string | The Access Key ID used to access a bucket. (example: DOACCESSKEYEXAMPLE) |
created_at | string (date-time) | The date and time the key was created. (example: 2018-07-19T15:04:16Z) |
grants | array | The list of permissions for the access key. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
spaces_key_get | select | access_key | To get a Spaces Access Key, send a GET request to /v2/spaces/keys/$ACCESS_KEY .A successful request will return the Access Key. | |
spaces_key_list | select | per_page , page , sort , sort_direction , name , bucket , permission | To list Spaces Access Key, send a GET request to /v2/spaces/keys . Sort parameter must be used with Sort Direction. | |
spaces_key_create | insert | To create a new Spaces Access Key, send a POST request to /v2/spaces/keys .At the moment, you cannot mix a fullaccess permission with scoped permissions. A fullaccess permission will be prioritized if fullaccess and scoped permissions are both added. | ||
spaces_key_patch | update | access_key | To update Spaces Access Key, send a PUT or PATCH request to /v2/spaces/keys/$ACCESS_KEY . At the moment, you cannot convert afullaccess key to a scoped key or vice versa. You can only update the name of the key. | |
spaces_key_update | replace | access_key | To update Spaces Access Key, send a PUT or PATCH request to /v2/spaces/keys/$ACCESS_KEY . At the moment, you cannot convert afullaccess key to a scoped key or vice versa. You can only update the name of the key. | |
spaces_key_delete | delete | access_key | To delete a Spaces Access Key, send a DELETE request to /v2/spaces/keys/$ACCESS_KEY .A successful request will return a 204 No Content status code. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
access_key | string | The access key's ID. (example: DOACCESSKEYEXAMPLE) |
bucket | string | The bucket's name. (example: my-bucket) |
name | string | The access key's name. (example: my-access-key) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
permission | string | The permission of the access key. Possible values are read , readwrite , fullaccess , or an empty string. (example: read) |
sort | string | The field to sort by. (example: created_at) |
sort_direction | string | The direction to sort by. Possible values are asc or desc . (example: desc) |
SELECT
examples
- spaces_key_get
- spaces_key_list
To get a Spaces Access Key, send a GET request to /v2/spaces/keys/$ACCESS_KEY
.
A successful request will return the Access Key.
SELECT
name,
access_key,
created_at,
grants
FROM digitalocean.spaces.keys
WHERE access_key = '{{ access_key }}' -- required;
To list Spaces Access Key, send a GET request to /v2/spaces/keys
. Sort parameter must be used with Sort Direction.
SELECT
name,
access_key,
created_at,
grants
FROM digitalocean.spaces.keys
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}'
AND sort = '{{ sort }}'
AND sort_direction = '{{ sort_direction }}'
AND name = '{{ name }}'
AND bucket = '{{ bucket }}'
AND permission = '{{ permission }}';
INSERT
examples
- spaces_key_create
- Manifest
To create a new Spaces Access Key, send a POST request to /v2/spaces/keys
.
At the moment, you cannot mix a fullaccess permission with scoped permissions.
A fullaccess permission will be prioritized if fullaccess and scoped permissions are both added.
INSERT INTO digitalocean.spaces.keys (
data__name,
data__grants
)
SELECT
'{{ name }}',
'{{ grants }}'
RETURNING
key
;
# Description fields are for documentation purposes
- name: keys
props:
- name: name
value: string
description: >
The access key's name.
- name: grants
value: array
description: >
The list of permissions for the access key.
default:
UPDATE
examples
- spaces_key_patch
To update Spaces Access Key, send a PUT or PATCH request to /v2/spaces/keys/$ACCESS_KEY
. At the moment, you cannot convert a
fullaccess key to a scoped key or vice versa. You can only update the name of the key.
UPDATE digitalocean.spaces.keys
SET
data__name = '{{ name }}',
data__grants = '{{ grants }}'
WHERE
access_key = '{{ access_key }}' --required
RETURNING
key;
REPLACE
examples
- spaces_key_update
To update Spaces Access Key, send a PUT or PATCH request to /v2/spaces/keys/$ACCESS_KEY
. At the moment, you cannot convert a
fullaccess key to a scoped key or vice versa. You can only update the name of the key.
REPLACE digitalocean.spaces.keys
SET
data__name = '{{ name }}',
data__grants = '{{ grants }}'
WHERE
access_key = '{{ access_key }}' --required
RETURNING
key;
DELETE
examples
- spaces_key_delete
To delete a Spaces Access Key, send a DELETE request to /v2/spaces/keys/$ACCESS_KEY
.
A successful request will return a 204 No Content
status code.
DELETE FROM digitalocean.spaces.keys
WHERE access_key = '{{ access_key }}' --required;