Create a Tag Default
post
/20160918/tagDefaults
Creates a new tag default in the specified compartment for the specified tag definition. If 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.
Request
Supported Media Types
- application/json
Header Parameters
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
-
opc-retry-token: string
Minimum Length:
1
Maximum Length:64
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 (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
Request object for creating a new tag default.
Root Schema : CreateTagDefaultDetails
Type:
Show Source
object
-
compartmentId(required):
string
The OCID of the compartment. The tag default will be applied to all new resources created in this compartment.
-
isRequired:
boolean
If 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. Note: 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
-
locks:
array locks
Maximum Number of Items:
1
Locks associated with this resource. -
tagDefinitionId(required):
string
The OCID of the tag definition. The tag default will always assign a default value for this tag definition.
-
value(required):
string
The default value for the tag definition. This will be applied to all new resources created in the compartment.
Nested Schema : locks
Type:
array
Maximum Number of Items:
1
Locks associated with this resource.
Show Source
-
Array of:
object AddLockDetails
Request payload to add lock to the resource.
Nested Schema : AddLockDetails
Type:
object
Request payload to add lock to the resource.
Show Source
-
message:
string
A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.
- relatedResourceId: string
-
type(required):
string
Allowed Values:
[ "FULL", "DELETE" ]
Lock type.
Response
Supported Media Types
- application/json
200 Response
The tag default has been created.
Headers
-
etag: string
For optimistic concurrency control. See `if-match`.
-
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.
Root Schema : TagDefault
Type:
object
Tag defaults let you specify a default tag (tagnamespace.tag="value") to apply to all resource types in a specified compartment. The tag default is applied at the time the resource is created. Resources that exist in the compartment before you create the tag default are not tagged. The TagDefault object specifies the tag and compartment details. Tag defaults are inherited by child compartments. This means that if you set a tag default on the root compartment for a tenancy, all resources that are created in the tenancy are tagged. To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator.
Show Source
-
compartmentId(required):
string
The 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.
-
id(required):
string
The OCID of the tag default.
-
isRequired(required):
boolean
If 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
-
lifecycleState:
string
Allowed Values:
[ "ACTIVE" ]
The tag default's current state. After creating a TagDefault, make sure its lifecycleState is ACTIVE before using it. -
locks:
array locks
Locks associated with this resource.
-
tagDefinitionId(required):
string
The OCID of the tag definition. The tag default will always assign a default value for this tag definition.
-
tagDefinitionName(required):
string
The name used in the tag definition. This field is informational in the context of the tag default.
-
tagNamespaceId(required):
string
The OCID of the tag namespace that contains the tag definition.
-
timeCreated(required):
string(date-time)
Date and time the TagDefault object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
-
value(required):
string
The default value for the tag definition. This will be applied to all resources created in the compartment.
Nested Schema : locks
Type:
array
Locks associated with this resource.
Show Source
-
Array of:
object ResourceLock
Resource locks are used to prevent certain APIs from being called for the resource. A full lock prevents both updating the resource and deleting the resource. A delete lock prevents deleting the resource.
Nested Schema : ResourceLock
Type:
object
Resource locks are used to prevent certain APIs from being called for the resource. A full lock prevents both updating the resource and deleting the resource. A delete lock prevents deleting the resource.
Show Source
-
message:
string
A message added by the creator of the lock. This is typically used to give an indication of why the resource is locked.
- relatedResourceId: string
-
timeCreated:
string(date-time)
Indicates when the lock was created, in the format defined by RFC 3339.
-
type(required):
string
Allowed Values:
[ "FULL", "DELETE" ]
Lock type.
Example Response (application-json)
{ "id" : "ocid1.tagdefault.oc1..aaaaaaaashexampleuniqueID", "compartmentId" : "ocid1.compartment.oc1..aaaaaaaaexampleuniqueID", "tagNamespaceId" : "ocid1.namespace.oc1..aaaaaaaasexampleuniqueID", "tagDefinitionId" : "ocid1.tagdefinition.oc1..aaaaaaaash5exampleuniqueID", "tagDefinitionName" : "Finance", "value" : "W123", "timeCreated" : "2018-11-22T19:00:00.000Z", "lifecycleState" : "ACTIVE", "isRequired" : "true" }
400 Response
Bad Request
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
401 Response
Unauthorized
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
404 Response
Not Found
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
409 Response
Conflict
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
429 Response
Too Many Requests
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
500 Response
Internal Server Error
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
Default Response
An error has occurred.
Headers
-
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.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.