resources
Creates, updates, deletes, gets or lists a resources
resource.
Overview
Name | resources |
Type | Resource |
Id | digitalocean.projects.resources |
Fields
The following fields are returned by SELECT
queries:
- projects_list_resources
The response will be a JSON object with a key called resources
.
The value of this will be an object with the standard resource attributes.
Only resources that you are authorized to see will be returned.
Name | Datatype | Description |
---|---|---|
assigned_at | string (date-time) | A time value given in ISO8601 combined date and time format that represents when the project was created. (example: 2018-09-28T19:26:37Z) |
links | object | The links object contains the self object, which contains the resource relationship. |
status | string | The status of assigning and fetching the resources. (example: ok) |
urn | string | The uniform resource name (URN) for the resource in the format do:resource_type:resource_id. (pattern: ^do:(dbaas|domain|droplet|floatingip|loadbalancer|space|volume|kubernetes|vpc):.*, example: do💧13457723) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
projects_list_resources | select | project_id | per_page , page | To list all your resources in a project, send a GET request to /v2/projects/$PROJECT_ID/resources .This endpoint will only return resources that you are authorized to see. For example, to see Droplets in a project, include the droplet:read scope. |
projects_assign_resources | insert | project_id | To assign resources to a project, send a POST request to /v2/projects/$PROJECT_ID/resources .You must have both project:update and <resource>:read scopes to assign new resources. For example, to assign a Droplet to a project, include both the project:update and droplet:read scopes. |
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 |
---|---|---|
project_id | string (uuid) | A unique identifier for a project. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- projects_list_resources
To list all your resources in a project, send a GET request to /v2/projects/$PROJECT_ID/resources
.
This endpoint will only return resources that you are authorized to see. For example, to see Droplets in a project, include the droplet:read
scope.
SELECT
assigned_at,
links,
status,
urn
FROM digitalocean.projects.resources
WHERE project_id = '{{ project_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';
INSERT
examples
- projects_assign_resources
- Manifest
To assign resources to a project, send a POST request to /v2/projects/$PROJECT_ID/resources
.
You must have both project:update
and <resource>:read
scopes to assign new resources. For example, to assign a Droplet to a project, include both the project:update
and droplet:read
scopes.
INSERT INTO digitalocean.projects.resources (
data__resources,
project_id
)
SELECT
'{{ resources }}',
'{{ project_id }}'
RETURNING
resources
;
# Description fields are for documentation purposes
- name: resources
props:
- name: project_id
value: string (uuid)
description: Required parameter for the resources resource.
- name: resources
value: array
description: >
A list of uniform resource names (URNs) to be added to a project. Only resources that you are authorized to see will be returned.