Create and Delete Tag Assignments
/paas/api/v1.1/tags/{identityDomainId}/assignments
Set the ?createTagsIfNeeded
query parameter to true
to create new tags if the tag assignments in the payload contain tags that do not yet exist.
Set the optional ?force
query parameter to true
to force the request to complete even if any specified tags, service resources, or tag assignments are not found.
Request
- application/json
-
identityDomainId: string
Identity domain ID for the Oracle Java Cloud Service account.
-
createTagsIfNeeded(optional): boolean
Flag that specifies whether to allow (
true
) or not allow (false
) tags to be created. -
force(optional): boolean
Flag that specifies whether to allow (
true
) or not allow (false
) the request to complete.
-
Authorization: string
Base64 encoded user name and password separated by a colon or OAuth access token obtained from Oracle Identity Cloud Service. See Authenticate.
-
X-ID-TENANT-NAME: string
Identity domain ID for the Oracle Java Cloud Service account.
Alternatively, you can omit TagsToUnassign
and deleteAssignmentsFrom
to just create tag assignments. Or you can omit TagsToAssign
and createAssignmentsTo
to just delete tag assignments.
object
-
createAssignmentsTo(optional):
object createAssignmentsTo
Groups the resources for tag assignments.
Note: The maximum number of tags allowed for a service instance is 50.
-
deleteAssignmentsFrom(optional):
object deleteAssignmentsFrom
Groups the resources for tag unassignments.
-
tagsToAssign(optional):
array tagsToAssign
Groups the tags to assign. Each tag object is a key/value pair.
-
tagsToUnassign(optional):
array tagsToUnassign
Groups the tags to unassign. Each tag object is a key/value pair.
object
Note: The maximum number of tags allowed for a service instance is 50.
-
services(optional):
array services
Groups the service resources to assign tags to. The tags are specified in
tagsToAssign
.
object
-
services(optional):
array services
Groups the service resources to unassign tags from. The tags are specified in
tagsToUnassign
.
array
tagsToAssign
.object
-
serviceName:
string
Name of the service instance to tag (or untag).
-
serviceType(optional):
string
Type of service.
For example,
JaaS
for a Java Cloud Service instance andDBaaS
for a Database Cloud Service deployment.
array
tagsToUnassign
.Response
- application/json
200 Response
The response body contains information about all tags and their assignments.
object
-
assignmentState(optional):
string
Whether tag assignment or unassignment is in progress. Possible values:
Assigning
,Unassigning
,Assigned
This property is not shown when you use the Create and Assign Tags endpoint or Create and Delete Assignments endpoint.
-
serviceName(optional):
string
Name of the service instance.
-
serviceType(optional):
string
Type of service.
For example,
JaaS
for a Java Cloud Service instance andDBaaS
for a Database Cloud Service deployment.
400 Response
object
-
details(optional):
object details
Groups details of a bad request, not found response, or conflict response.
object
-
issues(optional):
array issues
List of operation issues found.
-
message(optional):
string
Operation message.
Examples
The following example shows how to create and delete tag assignments in the same PUT request using cURL.
Note: The command in this example uses the URL structure https://rest_server_url/resource-path
, where rest_server_url
is the REST server to contact for your identity domain (or Cloud Account). See Send Requests.
cURL Command
curl -i -X PUT -u username:password -d @createdeleteassignments.json -H "Content-Type:application/json" -H "X-ID-TENANT-NAME:ExampleIdentityDomain" "https://rest_server_url/paas/api/v1.1/tags/ExampleIdentityDomain/assignments?createTagsIfNeeded=true"
Example of Request Body
The following shows an example of the request body in JSON format.
{
"tagsToAssign": [
{
"key": "environment",
"value": "qa"
},
{
"key": "environment",
"value": "development"
}
],
"tagsToUnassign": [
{
"key": "environment",
"value": "qa-other"
}
],
"createAssignmentsTo": {
"services": [
{
"serviceType": "JaaS",
"serviceName": "MyJCSExample"
}
]
},
"deleteAssignmentsFrom": {
"services": [
{
"serviceType": "JaaS",
"serviceName": "MyJCS01"
}
]
}
}
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 200 OK
Date: Fri, 05 Jan 2018 19:20:00 GMT
Content-Length: 312
Content-Type: application/vnd.com.oracle.oracloud.provisioning.Service+json
X-ORACLE-DMS-ECID: 1bcaf164-c5b5-4c70-b7d8-5a24c1e19493-00000bdf
X-Frame-Options: DENY
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS, HEAD
Access-Control-Allow-Headers: Content-Type, api_key, Authorization, X-ID-TENANT-NAME, X-USER-IDENTITY-DOMAIN-NAME
Access-Control-Allow-Origin: *
Example of Response Body
The following shows an example of a 200 response returned in JSON format.
[
{
"key":"environment",
"value":"qa-other",
"assignments":{
"services":[]
}
},
{
"key":"environment",
"value":"qa",
"assignments":{
"services":[
{
"serviceType":"JaaS",
"serviceName":"MyJCSExample"
}
]
}
},
{
"key":"environment",
"value":"development",
"assignments":{
"services":[
{
"serviceType":"JaaS",
"serviceName":"MyJCSExample"
}
]
}
}
]
The following shows an example of a 400 response.
{
"details": {
"message": "Assignment modification failed",
"issues": [
"[PSM-TAG-00018 A tag with key [helloworld] and value [production] does not exist]",
"[PSM-TAG-00018 A tag with key [helloworld] and value [development] does not exist]",
"[PSM-TAG-00015 The service with type [JaaS], name [ExampleService01] does not exist]",
"[PSM-TAG-00015 The service with type [JaaS], name [Example02Service] does not exist]"
]
}
}