tag_namespaces
Creates, updates, deletes, gets or lists a tag_namespaces resource.
Overview​
| Name | tag_namespaces |
| Type | Resource |
| Id | oci.identity.tag_namespaces |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The tagNamespace was retrieved.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the tag namespace. |
name | string | The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. |
compartmentId | string | The OCID of the compartment that contains the tag namespace. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | The description you assign to the tag namespace. |
freeformTags | object | Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
isRetired | boolean | Whether the tag namespace is retired. See [Retiring Key Definitions and Namespace Definitions](/Content/Tagging/Tasks/managingtagsandtagnamespaces.htm#retiringkeys). |
lifecycleState | string | The tagnamespace's current state. After creating a tagnamespace, make sure its lifecycleState is ACTIVE before using it. After retiring a tagnamespace, make sure its lifecycleState is INACTIVE before using it. (ACTIVE, INACTIVE, DELETING, DELETED) |
locks | array | Locks associated with this resource. |
systemTags | object | Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud": {"free-tier-retained": "true"}} |
timeCreated | string (date-time) | Date and time the tagNamespace was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z |
A container for defined tags.<br />
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the tag namespace. |
name | string | The name of the tag namespace. It must be unique across all tag namespaces in the tenancy and cannot be changed. |
compartmentId | string | The OCID of the compartment that contains the tag namespace. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | The description you assign to the tag namespace. |
freeformTags | object | Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
isRetired | boolean | Whether the tag namespace is retired. For more information, see [Retiring Key Definitions and Namespace Definitions](/Content/Tagging/Tasks/managingtagsandtagnamespaces.htm#retiringkeys). |
lifecycleState | string | The tagnamespace's current state. After creating a tagnamespace, make sure its lifecycleState is ACTIVE before using it. After retiring a tagnamespace, make sure its lifecycleState is INACTIVE before using it. (x-obmcs-enumref: #/definitions/TagNamespace/lifecycleState) |
locks | array | Locks associated with this resource. |
systemTags | object | The system tags for this resource. Each key is predefined and scoped to a namespace. Example: {"orcl-cloud": {"free-tier-retained": "true"}} |
timeCreated | string (date-time) | Date and time the tag namespace was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | tagNamespaceId, region | Gets the specified tag namespace's information.<br /> | |
list | select | compartmentId, region | page, limit, includeSubcompartments, lifecycleState | Lists the tag namespaces in the specified compartment.<br /> |
create | insert | region, name, compartmentId, description | opc-retry-token | Creates a new tag namespace in the specified compartment.<br /><br />You must specify the compartment ID in the request object (remember that the tenancy is simply the root<br />compartment).<br /><br />You must also specify a name for the namespace, which must be unique across all namespaces in your tenancy<br />and cannot be changed. The name can contain any ASCII character except the space (_) or period (.).<br />Names are case insensitive. That means, for example, "myNamespace" and "mynamespace" are not allowed<br />in the same tenancy. Once you created a namespace, you cannot change the name.<br />If you specify a name that's already in use in the tenancy, a 409 error is returned.<br /><br />You must also specify a description for the namespace.<br />It does not have to be unique, and you can change it with<br />[UpdateTagNamespace](#/en/identity/latest/TagNamespace/UpdateTagNamespace).<br /> |
update | update | tagNamespaceId, region | isLockOverride | Updates the the specified tag namespace. You can't update the namespace name.<br /><br />Updating isRetired to 'true' retires the namespace and all the tag definitions in the namespace. Reactivating a<br />namespace (changing isRetired from 'true' to 'false') does not reactivate tag definitions.<br />To reactivate the tag definitions, you must reactivate each one individually after you reactivate the namespace,<br />using [UpdateTag](#/en/identity/20160918/Tag/UpdateTag). For more information about retiring tag namespaces, see<br />[Retiring Key Definitions and Namespace Definitions](/Content/Tagging/Tasks/managingtagsandtagnamespaces.htm#retiringkeys).<br /><br />You can't add a namespace with the same name as a retired namespace in the same tenancy.<br /> |
delete | delete | tagNamespaceId, region | if-match, opc-request-id, isLockOverride | Deletes the specified tag namespace. Only an empty tag namespace can be deleted with this operation. To use this operation<br />to delete a tag namespace that contains tag definitions, first delete all of its tag definitions.<br /><br />Use [CascadeDeleteTagNamespace](#/en/identity/20160918/TagNamespace/CascadeDeleteTagNamespace) to delete a tag namespace along with all of<br />the tag definitions contained within that namespace.<br /><br />Use [DeleteTag](#/en/identity/latest/Tag/DeleteTag) to delete a tag definition.<br /> |
add_tag_namespace_lock | exec | tagNamespaceId, region, type | if-match, opc-request-id, opc-retry-token | Add a resource lock to a tag namespace.<br /> |
cascade_delete_tag_namespace | exec | tagNamespaceId, region | if-match, opc-request-id, opc-retry-token, isLockOverride | Deletes the specified tag namespace. This operation triggers a process that removes all of the tags<br />defined in the specified tag namespace from all resources in your tenancy and then deletes the tag namespace.<br /><br />After you start the delete operation:<br /><br /> * New tag key definitions cannot be created under the namespace.<br /> * The state of the tag namespace changes to DELETING.<br /> * Tag removal from the resources begins.<br /><br />This process can take up to 48 hours depending on the number of tag definitions in the namespace, the number of resources<br />that are tagged, and the locations of the regions in which those resources reside.<br /><br />After all tags are removed, the state changes to DELETED. You cannot restore a deleted tag namespace. After the deleted tag namespace<br />changes its state to DELETED, you can use the name of the deleted tag namespace again.<br /><br />After you start this operation, you cannot start either the [DeleteTag](#/en/identity/20160918/Tag/DeleteTag) or the [BulkDeleteTags](#/en/identity/20160918/Tag/BulkDeleteTags) operation until this process completes.<br /><br />To delete a tag namespace, you must first retire it. Use [UpdateTagNamespace](#/en/identity/20160918/TagNamespace/UpdateTagNamespace)<br />to retire a tag namespace.<br /> |
change_compartment | exec | tagNamespaceId, region, compartmentId | opc-retry-token, isLockOverride | Moves the specified tag namespace to the specified compartment within the same tenancy.<br /><br />To move the tag namespace, you must have the manage tag-namespaces permission on both compartments.<br />For more information about IAM policies, see [Details for IAM](/Content/Identity/policyreference/iampolicyreference.htm).<br /><br />Moving a tag namespace moves all the tag key definitions contained in the tag namespace.<br /> |
remove_tag_namespace_lock | exec | tagNamespaceId, region, type | if-match, opc-request-id, opc-retry-token | Remove a resource lock from a tag namespace.<br /> |
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 |
|---|---|---|
compartmentId | string | The OCID of the compartment (remember that the tenancy is simply the root compartment). |
region | string | OCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION) |
tagNamespaceId | string | The OCID of the tag namespace. |
if-match | string | For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value. |
includeSubcompartments | boolean | An optional boolean parameter indicating whether to retrieve all tag namespaces in subcompartments. If this parameter is not specified, only the tag namespaces defined in the specified compartment are retrieved. |
isLockOverride | boolean | Whether to override locks (if any exist). |
lifecycleState | string | A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. |
limit | integer | The maximum number of items to return in a paginated "List" call. |
opc-request-id | string | Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. |
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected). |
page | string | The value of the opc-next-page response header from the previous "List" call. |
SELECT examples​
- get
- list
Gets the specified tag namespace's information.<br />
SELECT
id,
name,
compartmentId,
definedTags,
description,
freeformTags,
isRetired,
lifecycleState,
locks,
systemTags,
timeCreated
FROM oci.identity.tag_namespaces
WHERE tagNamespaceId = '{{ tagNamespaceId }}' -- required
AND region = '{{ region }}' -- required
;
Lists the tag namespaces in the specified compartment.<br />
SELECT
id,
name,
compartmentId,
definedTags,
description,
freeformTags,
isRetired,
lifecycleState,
locks,
systemTags,
timeCreated
FROM oci.identity.tag_namespaces
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND page = '{{ page }}'
AND limit = '{{ limit }}'
AND includeSubcompartments = '{{ includeSubcompartments }}'
AND lifecycleState = '{{ lifecycleState }}'
;
INSERT examples​
- create
- Manifest
Creates a new tag namespace in the specified compartment.<br /><br />You must specify the compartment ID in the request object (remember that the tenancy is simply the root<br />compartment).<br /><br />You must also specify a name for the namespace, which must be unique across all namespaces in your tenancy<br />and cannot be changed. The name can contain any ASCII character except the space (_) or period (.).<br />Names are case insensitive. That means, for example, "myNamespace" and "mynamespace" are not allowed<br />in the same tenancy. Once you created a namespace, you cannot change the name.<br />If you specify a name that's already in use in the tenancy, a 409 error is returned.<br /><br />You must also specify a description for the namespace.<br />It does not have to be unique, and you can change it with<br />[UpdateTagNamespace](#/en/identity/latest/TagNamespace/UpdateTagNamespace).<br />
INSERT INTO oci.identity.tag_namespaces (
compartmentId,
definedTags,
description,
freeformTags,
locks,
name,
region,
opc-retry-token
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ definedTags }}',
'{{ description }}' /* required */,
'{{ freeformTags }}',
'{{ locks }}',
'{{ name }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}'
RETURNING
id,
name,
compartmentId,
definedTags,
description,
freeformTags,
isRetired,
lifecycleState,
locks,
systemTags,
timeCreated
;
# Description fields are for documentation purposes
- name: tag_namespaces
props:
- name: region
value: "{{ region }}"
description: Required parameter for the tag_namespaces resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
The OCID of the tenancy containing the tag namespace.
- name: definedTags
value: "{{ definedTags }}"
description: |
Defined tags for this resource. Each key is predefined and scoped to a namespace.
For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm).
Example: `{"Operations": {"CostCenter": "42"}}`
- name: description
value: "{{ description }}"
description: |
The description you assign to the tag namespace during creation.
- name: freeformTags
value: "{{ freeformTags }}"
description: |
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
For more information, see [Resource Tags](/Content/General/Concepts/resourcetags.htm).
Example: `{"Department": "Finance"}`
- name: locks
description: |
Locks associated with this resource.
value:
- message: "{{ message }}"
relatedResourceId: "{{ relatedResourceId }}"
type: "{{ type }}"
- name: name
value: "{{ name }}"
description: |
The name you assign to the tag namespace during creation. It must be unique across all tag namespaces in the tenancy and cannot be changed.
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
UPDATE examples​
- update
Updates the the specified tag namespace. You can't update the namespace name.<br /><br />Updating isRetired to 'true' retires the namespace and all the tag definitions in the namespace. Reactivating a<br />namespace (changing isRetired from 'true' to 'false') does not reactivate tag definitions.<br />To reactivate the tag definitions, you must reactivate each one individually after you reactivate the namespace,<br />using [UpdateTag](#/en/identity/20160918/Tag/UpdateTag). For more information about retiring tag namespaces, see<br />[Retiring Key Definitions and Namespace Definitions](/Content/Tagging/Tasks/managingtagsandtagnamespaces.htm#retiringkeys).<br /><br />You can't add a namespace with the same name as a retired namespace in the same tenancy.<br />
UPDATE oci.identity.tag_namespaces
SET
definedTags = '{{ definedTags }}',
description = '{{ description }}',
freeformTags = '{{ freeformTags }}',
isRetired = {{ isRetired }}
WHERE
tagNamespaceId = '{{ tagNamespaceId }}' --required
AND region = '{{ region }}' --required
AND isLockOverride = {{ isLockOverride}}
RETURNING
id,
name,
compartmentId,
definedTags,
description,
freeformTags,
isRetired,
lifecycleState,
locks,
systemTags,
timeCreated;
DELETE examples​
- delete
Deletes the specified tag namespace. Only an empty tag namespace can be deleted with this operation. To use this operation<br />to delete a tag namespace that contains tag definitions, first delete all of its tag definitions.<br /><br />Use [CascadeDeleteTagNamespace](#/en/identity/20160918/TagNamespace/CascadeDeleteTagNamespace) to delete a tag namespace along with all of<br />the tag definitions contained within that namespace.<br /><br />Use [DeleteTag](#/en/identity/latest/Tag/DeleteTag) to delete a tag definition.<br />
DELETE FROM oci.identity.tag_namespaces
WHERE tagNamespaceId = '{{ tagNamespaceId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
AND opc-request-id = '{{ opc-request-id }}'
AND isLockOverride = '{{ isLockOverride }}'
;
Lifecycle Methods​
- add_tag_namespace_lock
- cascade_delete_tag_namespace
- change_compartment
- remove_tag_namespace_lock
Add a resource lock to a tag namespace.<br />
EXEC oci.identity.tag_namespaces.add_tag_namespace_lock
@tagNamespaceId='{{ tagNamespaceId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"message": "{{ message }}",
"relatedResourceId": "{{ relatedResourceId }}",
"type": "{{ type }}"
}'
;
Deletes the specified tag namespace. This operation triggers a process that removes all of the tags<br />defined in the specified tag namespace from all resources in your tenancy and then deletes the tag namespace.<br /><br />After you start the delete operation:<br /><br /> * New tag key definitions cannot be created under the namespace.<br /> * The state of the tag namespace changes to DELETING.<br /> * Tag removal from the resources begins.<br /><br />This process can take up to 48 hours depending on the number of tag definitions in the namespace, the number of resources<br />that are tagged, and the locations of the regions in which those resources reside.<br /><br />After all tags are removed, the state changes to DELETED. You cannot restore a deleted tag namespace. After the deleted tag namespace<br />changes its state to DELETED, you can use the name of the deleted tag namespace again.<br /><br />After you start this operation, you cannot start either the [DeleteTag](#/en/identity/20160918/Tag/DeleteTag) or the [BulkDeleteTags](#/en/identity/20160918/Tag/BulkDeleteTags) operation until this process completes.<br /><br />To delete a tag namespace, you must first retire it. Use [UpdateTagNamespace](#/en/identity/20160918/TagNamespace/UpdateTagNamespace)<br />to retire a tag namespace.<br />
EXEC oci.identity.tag_namespaces.cascade_delete_tag_namespace
@tagNamespaceId='{{ tagNamespaceId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}',
@isLockOverride={{ isLockOverride }}
;
Moves the specified tag namespace to the specified compartment within the same tenancy.<br /><br />To move the tag namespace, you must have the manage tag-namespaces permission on both compartments.<br />For more information about IAM policies, see [Details for IAM](/Content/Identity/policyreference/iampolicyreference.htm).<br /><br />Moving a tag namespace moves all the tag key definitions contained in the tag namespace.<br />
EXEC oci.identity.tag_namespaces.change_compartment
@tagNamespaceId='{{ tagNamespaceId }}' --required,
@region='{{ region }}' --required,
@opc-retry-token='{{ opc-retry-token }}',
@isLockOverride={{ isLockOverride }}
@@json=
'{
"compartmentId": "{{ compartmentId }}"
}'
;
Remove a resource lock from a tag namespace.<br />
EXEC oci.identity.tag_namespaces.remove_tag_namespace_lock
@tagNamespaceId='{{ tagNamespaceId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"type": "{{ type }}"
}'
;