tags
Creates, updates, deletes, gets or lists a tags
resource.
Overview
Name | tags |
Type | Resource |
Id | digitalocean.tags.tags |
Fields
Name | Datatype | Description |
---|---|---|
name | string | The name of the tag. Tags may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per tag. Note: Tag names are case stable, which means the capitalization you use when you first create a tag is canonical. When working with tags in the API, you must use the tag's canonical capitalization. For example, if you create a tag named "PROD", the URL to add that tag to a resource would be https://api.digitalocean.com/v2/tags/PROD/resources (not /v2/tags/prod/resources ). Tagged resources in the control panel will always display the canonical capitalization. For example, if you create a tag named "PROD", you can tag resources in the control panel by entering "prod". The tag will still display with its canonical capitalization, "PROD". |
resources | object | Tagged Resource Statistics include metadata regarding the resource type that has been tagged. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
tags_get | SELECT | tag_id | To retrieve an individual tag, you can send a GET request to /v2/tags/$TAG_NAME . |
tags_list | SELECT |
| To list all of your tags, you can send a GET request to /v2/tags . |
tags_create | INSERT |
| To create a tag you can send a POST request to /v2/tags with a name attribute. |
tags_delete | DELETE | tag_id | A tag can be deleted by sending a DELETE request to /v2/tags/$TAG_NAME . Deleting a tag also untags all the resources that have previously been tagged by the Tag |
SELECT
examples
To list all of your tags, you can send a GET request to /v2/tags
.
SELECT
name,
resources
FROM digitalocean.tags.tags
;
INSERT
example
Use the following StackQL query and manifest file to create a new tags
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO digitalocean.tags.tags (
data__name,
data__resources
)
SELECT
'{{ name }}',
'{{ resources }}'
;
- name: tags
props:
- name: name
value: string
- name: resources
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
- name: droplets
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
- name: imgages
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
- name: volumes
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
- name: volume_snapshots
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
- name: databases
props:
- name: count
value: integer
- name: last_tagged_uri
value: string
DELETE
example
Deletes the specified tags
resource.
/*+ delete */
DELETE FROM digitalocean.tags.tags
WHERE tag_id = '{{ tag_id }}';