Tag

class oci.identity.models.Tag(**kwargs)

Bases: object

A tag definition that belongs to a specific tag namespace. “Defined tags” must be set up in your tenancy before you can apply them to resources. For more information, see Managing Tags and Tag Namespaces.

Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.

Attributes

LIFECYCLE_STATE_ACTIVE A constant which can be used with the lifecycle_state property of a Tag.
LIFECYCLE_STATE_DELETED A constant which can be used with the lifecycle_state property of a Tag.
LIFECYCLE_STATE_DELETING A constant which can be used with the lifecycle_state property of a Tag.
LIFECYCLE_STATE_INACTIVE A constant which can be used with the lifecycle_state property of a Tag.
compartment_id [Required] Gets the compartment_id of this Tag.
defined_tags Gets the defined_tags of this Tag.
description [Required] Gets the description of this Tag.
freeform_tags Gets the freeform_tags of this Tag.
id [Required] Gets the id of this Tag.
is_cost_tracking Gets the is_cost_tracking of this Tag.
is_retired [Required] Gets the is_retired of this Tag.
lifecycle_state Gets the lifecycle_state of this Tag.
name [Required] Gets the name of this Tag.
tag_namespace_id [Required] Gets the tag_namespace_id of this Tag.
tag_namespace_name [Required] Gets the tag_namespace_name of this Tag.
time_created [Required] Gets the time_created of this Tag.
validator Gets the validator of this Tag.

Methods

__init__(**kwargs) Initializes a new Tag object with values from keyword arguments.
LIFECYCLE_STATE_ACTIVE = 'ACTIVE'

A constant which can be used with the lifecycle_state property of a Tag. This constant has a value of “ACTIVE”

LIFECYCLE_STATE_DELETED = 'DELETED'

A constant which can be used with the lifecycle_state property of a Tag. This constant has a value of “DELETED”

LIFECYCLE_STATE_DELETING = 'DELETING'

A constant which can be used with the lifecycle_state property of a Tag. This constant has a value of “DELETING”

LIFECYCLE_STATE_INACTIVE = 'INACTIVE'

A constant which can be used with the lifecycle_state property of a Tag. This constant has a value of “INACTIVE”

__init__(**kwargs)

Initializes a new Tag object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • compartment_id (str) – The value to assign to the compartment_id property of this Tag.
  • tag_namespace_id (str) – The value to assign to the tag_namespace_id property of this Tag.
  • tag_namespace_name (str) – The value to assign to the tag_namespace_name property of this Tag.
  • id (str) – The value to assign to the id property of this Tag.
  • name (str) – The value to assign to the name property of this Tag.
  • description (str) – The value to assign to the description property of this Tag.
  • freeform_tags (dict(str, str)) – The value to assign to the freeform_tags property of this Tag.
  • defined_tags (dict(str, dict(str, object))) – The value to assign to the defined_tags property of this Tag.
  • is_retired (bool) – The value to assign to the is_retired property of this Tag.
  • lifecycle_state (str) – The value to assign to the lifecycle_state property of this Tag. Allowed values for this property are: “ACTIVE”, “INACTIVE”, “DELETING”, “DELETED”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
  • time_created (datetime) – The value to assign to the time_created property of this Tag.
  • is_cost_tracking (bool) – The value to assign to the is_cost_tracking property of this Tag.
  • validator (BaseTagDefinitionValidator) – The value to assign to the validator property of this Tag.
compartment_id

[Required] Gets the compartment_id of this Tag. The OCID of the compartment that contains the tag definition.

Returns:The compartment_id of this Tag.
Return type:str
defined_tags

Gets the defined_tags of this Tag. Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.

Example: {“Operations”: {“CostCenter”: “42”}}

Returns:The defined_tags of this Tag.
Return type:dict(str, dict(str, object))
description

[Required] Gets the description of this Tag. The description you assign to the tag.

Returns:The description of this Tag.
Return type:str
freeform_tags

Gets the freeform_tags of this Tag. 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.

Example: {“Department”: “Finance”}

Returns:The freeform_tags of this Tag.
Return type:dict(str, str)
id

[Required] Gets the id of this Tag. The OCID of the tag definition.

Returns:The id of this Tag.
Return type:str
is_cost_tracking

Gets the is_cost_tracking of this Tag. Indicates whether the tag is enabled for cost tracking.

Returns:The is_cost_tracking of this Tag.
Return type:bool
is_retired

[Required] Gets the is_retired of this Tag. Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.

Returns:The is_retired of this Tag.
Return type:bool
lifecycle_state

Gets the lifecycle_state of this Tag. The tag’s current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag’s lifecycleState changes from DELETING to DELETED.

Allowed values for this property are: “ACTIVE”, “INACTIVE”, “DELETING”, “DELETED”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The lifecycle_state of this Tag.
Return type:str
name

[Required] Gets the name of this Tag. The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.

Returns:The name of this Tag.
Return type:str
tag_namespace_id

[Required] Gets the tag_namespace_id of this Tag. The OCID of the namespace that contains the tag definition.

Returns:The tag_namespace_id of this Tag.
Return type:str
tag_namespace_name

[Required] Gets the tag_namespace_name of this Tag. The name of the tag namespace that contains the tag definition.

Returns:The tag_namespace_name of this Tag.
Return type:str
time_created

[Required] Gets the time_created of this Tag. Date and time the tag was created, in the format defined by RFC3339.

Example: 2016-08-25T21:10:29.600Z

Returns:The time_created of this Tag.
Return type:datetime
validator

Gets the validator of this Tag. The tag must have a value type, which is specified with a validator. Tags can use either a static value or a list of possible values. Static values are entered by a user applying the tag to a resource. Lists are created by you and the user must apply a value from the list. Lists are validiated.

If you use the default validiator (or don’t define a validator), the user applying the tag enters a value. No additional validation is performed.

To clear the validator, call UpdateTag with DefaultTagDefinitionValidator.

Returns:The validator of this Tag.
Return type:BaseTagDefinitionValidator