Skip to main content

tag_defaults

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

Overview​

Nametag_defaults
TypeResource
Idoci.identity.tag_defaults

Fields​

The following fields are returned by SELECT queries:

The tag default was retrieved.

NameDatatypeDescription
idstringThe OCID of the tag default.
compartmentIdstringThe OCID of the compartment. The tag default applies to all new resources that get created in the compartment. Resources that existed before the tag default was created are not tagged.
isRequiredbooleanIf you specify that a value is required, a value is set during resource creation (either by the user creating the resource or another tag defualt). If no value is set, resource creation is blocked. * If the isRequired flag is set to "true", the value is set during resource creation. * If the isRequired flag is set to "false", the value you enter is set during resource creation. Example: false
lifecycleStatestringThe tag default's current state. After creating a TagDefault, make sure its lifecycleState is ACTIVE before using it. (ACTIVE)
locksarrayLocks associated with this resource.
tagDefinitionIdstringThe OCID of the tag definition. The tag default will always assign a default value for this tag definition.
tagDefinitionNamestringThe name used in the tag definition. This field is informational in the context of the tag default.
tagNamespaceIdstringThe OCID of the tag namespace that contains the tag definition.
timeCreatedstring (date-time)Date and time the TagDefault object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
valuestringThe default value for the tag definition. This will be applied to all resources created in the compartment.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecttagDefaultId, regionRetrieves the specified tag default.<br />
listselectregionpage, limit, id, compartmentId, tagDefinitionId, lifecycleStateLists the tag defaults for tag definitions in the specified compartment.<br />
createinsertregion, compartmentId, tagDefinitionId, valueopc-retry-token, opc-request-idCreates a new tag default in the specified compartment for the specified tag definition.<br /><br />If you specify that a value is required, a value is set during resource creation (either by<br />the user creating the resource or another tag defualt). If no value is set, resource creation<br />is blocked.<br /><br />* If the isRequired flag is set to "true", the value is set during resource creation.<br />* If the isRequired flag is set to "false", the value you enter is set during resource creation.<br />
updateupdatetagDefaultId, region, valueisLockOverride, if-match, opc-request-idUpdates the specified tag default. If you specify that a value is required, a value is set<br />during resource creation (either by the user creating the resource or another tag defualt).<br />If no value is set, resource creation is blocked.<br /><br />* If the isRequired flag is set to "true", the value is set during resource creation.<br />* If the isRequired flag is set to "false", the value you enter is set during resource creation.<br />
deletedeletetagDefaultId, regionopc-request-id, if-match, isLockOverrideDeletes the the specified tag default.<br />
assemble_effective_tag_setexeccompartmentId, regionlifecycleStateAssembles tag defaults in the specified compartment and any parent compartments to determine<br />the tags to apply. Tag defaults from parent compartments do not override tag defaults<br />referencing the same tag in a compartment lower down the hierarchy. This set of tag defaults<br />includes all tag defaults from the current compartment back to the root compartment.<br />
add_tag_default_lockexectagDefaultId, region, typeif-match, opc-request-id, opc-retry-tokenAdd a resource lock to a tag default.<br />
remove_tag_default_lockexectagDefaultId, region, typeif-match, opc-request-id, opc-retry-tokenRemove a resource lock from a tag default.<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.

NameDatatypeDescription
compartmentIdstringThe OCID of the compartment (remember that the tenancy is simply the root compartment).
regionstringOCI 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)
tagDefaultIdstringThe OCID of the tag default.
compartmentIdstringThe OCID of the compartment (remember that the tenancy is simply the root compartment).
idstringA filter to only return resources that match the specified OCID exactly.
if-matchstringFor 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.
isLockOverridebooleanWhether to override locks (if any exist).
lifecycleStatestringA filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
limitintegerThe maximum number of items to return in a paginated "List" call.
opc-request-idstringUnique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA 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).
pagestringThe value of the opc-next-page response header from the previous "List" call.
tagDefinitionIdstringThe OCID of the tag definition.

SELECT examples​

Retrieves the specified tag default.<br />

SELECT
id,
compartmentId,
isRequired,
lifecycleState,
locks,
tagDefinitionId,
tagDefinitionName,
tagNamespaceId,
timeCreated,
value
FROM oci.identity.tag_defaults
WHERE tagDefaultId = '{{ tagDefaultId }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples​

Creates a new tag default in the specified compartment for the specified tag definition.<br /><br />If you specify that a value is required, a value is set during resource creation (either by<br />the user creating the resource or another tag defualt). If no value is set, resource creation<br />is blocked.<br /><br />* If the isRequired flag is set to "true", the value is set during resource creation.<br />* If the isRequired flag is set to "false", the value you enter is set during resource creation.<br />

INSERT INTO oci.identity.tag_defaults (
compartmentId,
isRequired,
locks,
tagDefinitionId,
value,
region,
opc-retry-token,
opc-request-id
)
SELECT
'{{ compartmentId }}' /* required */,
{{ isRequired }},
'{{ locks }}',
'{{ tagDefinitionId }}' /* required */,
'{{ value }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}',
'{{ opc-request-id }}'
RETURNING
id,
compartmentId,
isRequired,
lifecycleState,
locks,
tagDefinitionId,
tagDefinitionName,
tagNamespaceId,
timeCreated,
value
;

UPDATE examples​

Updates the specified tag default. If you specify that a value is required, a value is set<br />during resource creation (either by the user creating the resource or another tag defualt).<br />If no value is set, resource creation is blocked.<br /><br />* If the isRequired flag is set to "true", the value is set during resource creation.<br />* If the isRequired flag is set to "false", the value you enter is set during resource creation.<br />

UPDATE oci.identity.tag_defaults
SET
isRequired = {{ isRequired }},
value = '{{ value }}'
WHERE
tagDefaultId = '{{ tagDefaultId }}' --required
AND region = '{{ region }}' --required
AND value = '{{ value }}' --required
AND isLockOverride = {{ isLockOverride}}
AND if-match = '{{ if-match}}'
AND opc-request-id = '{{ opc-request-id}}'
RETURNING
id,
compartmentId,
isRequired,
lifecycleState,
locks,
tagDefinitionId,
tagDefinitionName,
tagNamespaceId,
timeCreated,
value;

DELETE examples​

Deletes the the specified tag default.<br />

DELETE FROM oci.identity.tag_defaults
WHERE tagDefaultId = '{{ tagDefaultId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id }}'
AND if-match = '{{ if-match }}'
AND isLockOverride = '{{ isLockOverride }}'
;

Lifecycle Methods​

Assembles tag defaults in the specified compartment and any parent compartments to determine<br />the tags to apply. Tag defaults from parent compartments do not override tag defaults<br />referencing the same tag in a compartment lower down the hierarchy. This set of tag defaults<br />includes all tag defaults from the current compartment back to the root compartment.<br />

EXEC oci.identity.tag_defaults.assemble_effective_tag_set
@compartmentId='{{ compartmentId }}' --required,
@region='{{ region }}' --required,
@lifecycleState='{{ lifecycleState }}'
;