Skip to main content

resources

Creates, updates, deletes, gets or lists a resources resource.

Overview

Nameresources
TypeResource
Iddigitalocean.projects.resources

Fields

The following fields are returned by SELECT queries:

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.

NameDatatypeDescription
assigned_atstring (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)
linksobjectThe links object contains the self object, which contains the resource relationship.
statusstringThe status of assigning and fetching the resources. (example: ok)
urnstringThe 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:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_list_resourcesselectproject_idper_page, pageTo 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_resourcesinsertproject_idTo 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.

NameDatatypeDescription
project_idstring (uuid)A unique identifier for a project. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

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

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
;