resources
Creates, updates, deletes, gets or lists a resources resource.
Overview​
| Name | resources |
| Type | Resource |
| Id | ovh.iam.resources |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Identifier of the resource |
name | string | Resource name |
display_name | string | Resource display name (wire: displayName) |
owner | string | Resource owner |
tags | object | Resource tags. Tags that were internally computed are prefixed with ovh: |
type | string | Resource type. All types can be retrieved at /reference/resource/type. |
urn | string | Unique resource name used in policies |
Resource is an entity standing for a product. It is used for right delegation.
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Identifier of the resource |
name | string | Resource name |
display_name | string | Resource display name (wire: displayName) |
owner | string | Resource owner |
tags | object | Resource tags. Tags that were internally computed are prefixed with ovh: |
type | string | Resource type. All types can be retrieved at /reference/resource/type. |
urn | string | Unique resource name used in policies |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_urn | Returns the details of a resource identified by its URN. | |
list | select | x_pagination_cursor, x_pagination_size, resource_name, resource_type, resource_urn, tags | Returns the resources of the account. Filter by resourceType, resourceName, resourceURN pattern and tag filters. | |
update | update | resource_urn | 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. | |
authorization_check | exec | resourceURN, actions | Checks the listed actions on this resource.<br />Returns the actions that are authorized and those that are not. | |
tag | exec | resourceURN, key, value | Adds 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_tag | exec | key, resourceURN | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The 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"}}) |
key | string | Key |
resourceURN | string | ResourceURN |
resource_urn | string | ResourceURN (wire: resourceURN) |
resource_name | array | Filter resources for specific resource names (wire: resourceName) |
resource_type | array | Filter resources for specific resource types (wire: resourceType) |
resource_urn | array | Filter resources for specific resource URN patterns (wire: resourceURN) |
tags | object | Filter resources using tag filters |
x_pagination_cursor | string | Pagination cursor (wire: X-Pagination-Cursor) |
x_pagination_size | integer | Pagination size (wire: X-Pagination-Size) |
SELECT examples​
- get
- list
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
;
Returns the resources of the account. Filter by resourceType, resourceName, resourceURN pattern and tag filters.
SELECT
id,
name,
display_name,
owner,
tags,
type,
urn
FROM ovh.iam.resources
WHERE x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
AND resource_name = '{{ resource_name }}'
AND resource_type = '{{ resource_type }}'
AND resource_urn = '{{ resource_urn }}'
AND tags = '{{ tags }}'
;
UPDATE examples​
- update
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.
- authorization_check
- tag
- delete_tag
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 }}"
}'
;
Adds 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.
EXEC ovh.iam.resources.tag
@resourceURN='{{ resourceURN }}' --required
@@json=
'{
"key": "{{ key }}",
"value": "{{ value }}"
}'
;
Deletes 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.
EXEC ovh.iam.resources.delete_tag
@key='{{ key }}' --required,
@resourceURN='{{ resourceURN }}' --required
;