Create a Compartment
/20160918/compartments
You must specify a name for the compartment, which must be unique across all compartments in your tenancy. You can use either the compartment name or OCID when writing policies for the compartment.
You must specify a description for the compartment, although it can be an empty string).
After you send your request, the new object's lifecycleState will temporarily be CREATING. Before using the object, first make sure its lifecycleState has changed to ACTIVE.
Request
- application/json
-
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).
object
-
compartmentId(required):
string
The OCID of the parent compartment containing the compartment.
-
definedTags:
object definedTags
Additional Properties Allowed: additionalPropertiesDefined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
-
description(required):
string
Minimum Length:
1
Maximum Length:400
The description you assign to the compartment during creation. Does not need to be unique, and it is changeable. -
freeformTags:
object freeformTags
Additional Properties Allowed: additionalPropertiesFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
-
isMaximumSecurityZone:
boolean
Flag indicate whether this compartment has Security Zone enabled.
-
name(required):
string
Minimum Length:
1
Maximum Length:100
The name you assign to the compartment during creation. The name must be unique across all compartments in the parent compartment. Avoid entering confidential information. -
securityZoneId:
string
The OCID of the Security Zone to associate this compartment with.
object
-
object additionalProperties
Additional Properties Allowed: additionalPropertiesKey-value pair representing a defined tag key and value, scoped to a namespace. Example: `{"CostCenter": "42"}`
object
object
-
object additionalProperties
The value of the tag. Only the String type is supported.
object
Response
- application/json
200 Response
-
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.
object
A common approach is to create a compartment for each major part of your organization. To place a resource in a compartment, simply specify the compartment OCID when you create the resource. For example, to launch an instance into a particular compartment, specify the OCID of that compartment in the LaunchInstance request.
Avoid entering confidential information when you supply string values using the API.
-
compartmentId(required):
string
The OCID of the parent compartment containing the compartment.
-
definedTags:
object definedTags
Additional Properties Allowed: additionalPropertiesDefined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
-
description(required):
string
Minimum Length:
1
Maximum Length:400
The description you assign to the compartment. Does not need to be unique, and it is changeable. -
freeformTags:
object freeformTags
Additional Properties Allowed: additionalPropertiesFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
-
id(required):
string
The OCID of the compartment.
-
inactiveStatus:
integer(int64)
The detailed status of INACTIVE lifecycleState.
-
isAccessible:
boolean
Indicates whether or not the compartment is accessible for the user making the request. Returns true when the user has INSPECT permissions directly on a resource in the compartment or indirectly (permissions can be on a resource in a subcompartment).
-
isMaximumSecurityZone:
boolean
Flag indicate whether this compartment has Security Zone enabled.
-
lifecycleState(required):
string
Minimum Length:
1
Maximum Length:64
Allowed Values:[ "CREATING", "ACTIVE", "INACTIVE", "DELETING", "DELETED" ]
The compartment's current state. After creating a compartment, make sure its lifecycleState changes from CREATING to ACTIVE before using it. -
name(required):
string
Minimum Length:
1
Maximum Length:100
The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information. -
securityZoneId:
string
The OCID of the Security Zone this compartment is associated with.
-
timeCreated(required):
string(date-time)
Date and time the compartment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
object
-
object additionalProperties
Additional Properties Allowed: additionalPropertiesKey-value pair representing a defined tag key and value, scoped to a namespace. Example: `{"CostCenter": "42"}`
object
object
-
object additionalProperties
The value of the tag. Only the String type is supported.
object
{ "id" : "ocid1.compartment.oc1..aaaaaaaayzexampleuniqueID", "compartmentId" : "ocid1.tenancy.oc1..aaaaaaaaba3pexampleuniqueID", "name" : "Network", "description" : "For network components", "lifecycleState" : "ACTIVE", "timeCreated" : "2016-11-18T23:01:40.936Z" }
401 Response
-
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.
object
-
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
-
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.
object
-
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
-
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.
object
-
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
-
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.
object
-
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
-
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.
object
-
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.