ListCompartments

get

/20160918/compartments

Lists the compartments in a specified compartment. The members of the list returned depends on the values set for several parameters. With the exception of the tenancy (root compartment), the ListCompartments operation returns only the first-level child compartments in the parent compartment specified in compartmentId. The list does not include any subcompartments of the child compartments (grandchildren). The parameter accessLevel specifies whether to return only those compartments for which the requestor has INSPECT permissions on at least one resource directly or indirectly (the resource can be in a subcompartment). The parameter compartmentIdInSubtree applies only when you perform ListCompartments on the tenancy (root compartment). When set to true, the entire hierarchy of compartments can be returned. To get a full list of all compartments and subcompartments in the tenancy (root compartment), set the parameter compartmentIdInSubtree to true and accessLevel to ANY.

Request

Supported Media Types
Query Parameters
  • Valid values are ANY and ACCESSIBLE. Default is ANY. Setting this to ACCESSIBLE returns only those compartments for which the user has INSPECT permissions directly or indirectly (permissions can be on a resource in a subcompartment). For the compartments on which the user indirectly has INSPECT permissions, a restricted set of fields is returned. When set to ANY permissions are not checked.
    Allowed Values: [ "ANY", "ACCESSIBLE" ]
  • Minimum Length: 1
    Maximum Length: 255
    The OCID of the compartment.
  • Whether to list subcompartments of the tenancy. Default is false. Can only be set to true when performing ListCompartments on the tenancy (root compartment). When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned depending on the the setting of accessLevel.
  • A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
  • Minimum Value: 1
    Maximum Value: 1000
    For list pagination. The maximum number of results per page, or items to return in a paginated List call. 1 is the minimum, 1000 is the maximum.
    Default Value: 100
  • Minimum Length: 1
    Maximum Length: 255
    A filter to only return resources that match the given name exactly.
  • Minimum Length: 1
    Maximum Length: 512
    For list pagination. The value of the opc-next-page response header from the previous List call.
    Default Value: oracle.doceng.json.BetterJsonNull@2c07545f
  • The optional field to sort the results by.
    Default Value: NAME
    Allowed Values: [ "ID", "NAME", "TIME_CREATED" ]
  • The sort order to use, either ascending (ASC) or descending (DESC).
    Allowed Values: [ "ASC", "DESC" ]
  • This parameter is required to retrieve securityZoneId associated with the compartment.
    Allowed Values: [ "securityZone" ]
Back to Top

Response

Supported Media Types

200 Response

The list is being retrieved.
Headers
  • For list pagination. When this header appears in the response, additional pages of results remain. Use this value as the page parameter to get the next page of items.
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : schema
Type: array
Show Source
  • Compartment
    A compartment is a collection of related resources. Compartments are a fundamental component for organizing and isolating cloud resources. For example, use compartments to separate resources for one project or business unit from another, or to manage access to the resources through the use of IAM Service policies.

    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.

Nested Schema : Compartment
Type: object
A compartment is a collection of related resources. Compartments are a fundamental component for organizing and isolating cloud resources. For example, use compartments to separate resources for one project or business unit from another, or to manage access to the resources through the use of IAM Service policies.

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.

Show Source
Nested Schema : definedTags
Type: object
Additional Properties Allowed
Show Source
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
Nested Schema : freeformTags
Type: object
Additional Properties Allowed
Show Source
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
Nested Schema : additionalProperties
Type: object
Additional Properties Allowed
Show Source
Key-value pair representing a defined tag key and value, scoped to a namespace. Example: {"CostCenter": "42"}
Nested Schema : additionalProperties
Type: object
The value of the tag. Only the String type is supported.

400 Response

Bad Request
Headers
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : Error
Type: object
The properties that define an error.
Show Source

403 Response

Forbidden
Headers
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : Error
Type: object
The properties that define an error.
Show Source

404 Response

Not Found
Headers
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : Error
Type: object
The properties that define an error.
Show Source

500 Response

Internal Server Error
Headers
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : Error
Type: object
The properties that define an error.
Show Source

Default Response

An error has occurred.
Headers
  • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
Body ()
Root Schema : Error
Type: object
The properties that define an error.
Show Source
Back to Top