Skip to main content

resources

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

Overview​

Nameresources
TypeResource
Idovh.iam.resources

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Identifier of the resource
namestringResource name
display_namestringResource display name (wire: displayName)
ownerstringResource owner
tagsobjectResource tags. Tags that were internally computed are prefixed with ovh:
typestringResource type. All types can be retrieved at /reference/resource/type.
urnstringUnique resource name used in policies

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_urnReturns the details of a resource identified by its URN.
listselectx_pagination_cursor, x_pagination_size, resource_name, resource_type, resource_urn, tagsReturns the resources of the account. Filter by resourceType, resourceName, resourceURN pattern and tag filters.
updateupdateresource_urnUpdates the tags of the resource. Adding a tag requires the $resourceType:apiovh:iam/resource/tag/add action and removing one requires $resourceType:apiovh:iam/resource/tag/remove, with $resourceType the type of the resource.
authorization_checkexecresourceURN, actionsChecks the listed actions on this resource.<br />Returns the actions that are authorized and those that are not.
tagexecresourceURN, key, valueAdds a tag, made of a key and a value, to the resource. Requires the $resourceType:apiovh:iam/resource/tag/add action on the resource type.
delete_tagexeckey, resourceURNDeletes the tag identified by its key. Computed ovh: tags cannot be deleted. Requires the $resourceType:apiovh:iam/resource/tag/remove action on the resource type.

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
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
keystringKey
resourceURNstringResourceURN
resource_urnstringResourceURN (wire: resourceURN)
resource_namearrayFilter resources for specific resource names (wire: resourceName)
resource_typearrayFilter resources for specific resource types (wire: resourceType)
resource_urnarrayFilter resources for specific resource URN patterns (wire: resourceURN)
tagsobjectFilter resources using tag filters
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the details of a resource identified by its URN.

SELECT
id,
name,
display_name,
owner,
tags,
type,
urn
FROM ovh.iam.resources
WHERE resource_urn = '{{ resource_urn }}' -- required
;

UPDATE examples​

Updates the tags of the resource. Adding a tag requires the $resourceType:apiovh:iam/resource/tag/add action and removing one requires $resourceType:apiovh:iam/resource/tag/remove, with $resourceType the type of the resource.

UPDATE ovh.iam.resources
SET
tags = '{{ tags }}'
WHERE
resource_urn = '{{ resource_urn }}' --required
RETURNING
id,
name,
display_name,
owner,
tags,
type,
urn;

Lifecycle Methods​

EXEC variables use wire (API) names.

Checks the listed actions on this resource.<br />Returns the actions that are authorized and those that are not.

EXEC ovh.iam.resources.authorization_check
@resourceURN='{{ resourceURN }}' --required
@@json=
'{
"actions": "{{ actions }}"
}'
;