Compartment¶
- class oci.identity.models.Compartment(**kwargs)¶
Bases:
objectA collection of related resources. Compartments are a fundamental component of Oracle Cloud Infrastructure for organizing and isolating your cloud resources. You use them to clearly separate resources for the purposes of measuring usage and billing, access (through the use of IAM Service policies), and isolation (separating the resources for one project or business unit from another). A common approach is to create a compartment for each major part of your organization. For more information, see Overview of IAM and also Setting Up Your Tenancy.
To place a resource in a compartment, simply specify the compartment ID in the “Create” request object when initially creating the resource. For example, to launch an instance into a particular compartment, specify that compartment’s OCID in the LaunchInstance request. You can’t move an existing resource from one compartment to another.
To use any of the API operations, you must be authorized in an IAM policy. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see Get Started with Policies.
Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.
Attributes:
A constant which can be used with the lifecycle_state property of a Compartment.
A constant which can be used with the lifecycle_state property of a Compartment.
A constant which can be used with the lifecycle_state property of a Compartment.
A constant which can be used with the lifecycle_state property of a Compartment.
A constant which can be used with the lifecycle_state property of a Compartment.
[Required] Gets the compartment_id of this Compartment.
Gets the defined_tags of this Compartment.
[Required] Gets the description of this Compartment.
Gets the freeform_tags of this Compartment.
[Required] Gets the id of this Compartment.
Gets the inactive_status of this Compartment.
Gets the is_accessible of this Compartment.
[Required] Gets the lifecycle_state of this Compartment.
[Required] Gets the name of this Compartment.
[Required] Gets the time_created of this Compartment.
Methods:
__init__(**kwargs)Initializes a new Compartment object with values from keyword arguments.
- LIFECYCLE_STATE_ACTIVE = 'ACTIVE'¶
A constant which can be used with the lifecycle_state property of a Compartment. This constant has a value of “ACTIVE”
- LIFECYCLE_STATE_CREATING = 'CREATING'¶
A constant which can be used with the lifecycle_state property of a Compartment. This constant has a value of “CREATING”
- LIFECYCLE_STATE_DELETED = 'DELETED'¶
A constant which can be used with the lifecycle_state property of a Compartment. This constant has a value of “DELETED”
- LIFECYCLE_STATE_DELETING = 'DELETING'¶
A constant which can be used with the lifecycle_state property of a Compartment. This constant has a value of “DELETING”
- LIFECYCLE_STATE_INACTIVE = 'INACTIVE'¶
A constant which can be used with the lifecycle_state property of a Compartment. This constant has a value of “INACTIVE”
- __init__(**kwargs)¶
Initializes a new Compartment object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):
- Parameters
id (str) – The value to assign to the id property of this Compartment.
compartment_id (str) – The value to assign to the compartment_id property of this Compartment.
name (str) – The value to assign to the name property of this Compartment.
description (str) – The value to assign to the description property of this Compartment.
time_created (datetime) – The value to assign to the time_created property of this Compartment.
lifecycle_state (str) – The value to assign to the lifecycle_state property of this Compartment. Allowed values for this property are: “CREATING”, “ACTIVE”, “INACTIVE”, “DELETING”, “DELETED”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
inactive_status (int) – The value to assign to the inactive_status property of this Compartment.
is_accessible (bool) – The value to assign to the is_accessible property of this Compartment.
freeform_tags (dict(str, str)) – The value to assign to the freeform_tags property of this Compartment.
defined_tags (dict(str, dict(str, object))) – The value to assign to the defined_tags property of this Compartment.
- property compartment_id¶
[Required] Gets the compartment_id of this Compartment. The OCID of the parent compartment containing the compartment.
- Returns
The compartment_id of this Compartment.
- Return type
str
- property defined_tags¶
Gets the defined_tags of this Compartment. 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 Compartment.
- Return type
dict(str, dict(str, object))
- property description¶
[Required] Gets the description of this Compartment. The description you assign to the compartment. Does not have to be unique, and it’s changeable.
- Returns
The description of this Compartment.
- Return type
str
- property freeform_tags¶
Gets the freeform_tags of this Compartment. 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 Compartment.
- Return type
dict(str, str)
- property id¶
[Required] Gets the id of this Compartment. The OCID of the compartment.
- Returns
The id of this Compartment.
- Return type
str
- property inactive_status¶
Gets the inactive_status of this Compartment. The detailed status of INACTIVE lifecycleState.
- Returns
The inactive_status of this Compartment.
- Return type
int
- property is_accessible¶
Gets the is_accessible of this Compartment. 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).
- Returns
The is_accessible of this Compartment.
- Return type
bool
- property lifecycle_state¶
[Required] Gets the lifecycle_state of this Compartment. The compartment’s current state. After creating a compartment, make sure its lifecycleState changes from CREATING to ACTIVE before using it.
Allowed values for this property are: “CREATING”, “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 Compartment.
- Return type
str
- property name¶
[Required] Gets the name of this Compartment. The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- Returns
The name of this Compartment.
- Return type
str
- property time_created¶
[Required] Gets the time_created of this Compartment. Date and time the compartment was created, in the format defined by RFC3339.
Example: 2016-08-25T21:10:29.600Z
- Returns
The time_created of this Compartment.
- Return type
datetime