oci.Identity.getCompartment
Explore with Pulumi AI
This data source provides details about a specific Compartment resource in Oracle Cloud Infrastructure Identity service.
Gets the specified compartment’s information.
This operation does not return a list of all the resources inside the compartment. There is no single API operation that does that. Compartments can contain multiple types of resources (instances, block storage volumes, etc.). To find out what’s in a compartment, you must call the “List” operation for each resource type and specify the compartment’s OCID as a query parameter in the request. For example, call the ListInstances operation in the Cloud Compute Service or the ListVolumes operation in Cloud Block Storage.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testCompartment = oci.Identity.getCompartment({
id: compartmentId,
});
import pulumi
import pulumi_oci as oci
test_compartment = oci.Identity.get_compartment(id=compartment_id)
package main
import (
"github.com/pulumi/pulumi-oci/sdk/go/oci/Identity"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := Identity.GetCompartment(ctx, &identity.GetCompartmentArgs{
Id: compartmentId,
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;
return await Deployment.RunAsync(() =>
{
var testCompartment = Oci.Identity.GetCompartment.Invoke(new()
{
Id = compartmentId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.IdentityFunctions;
import com.pulumi.oci.Identity.inputs.GetCompartmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var testCompartment = IdentityFunctions.getCompartment(GetCompartmentArgs.builder()
.id(compartmentId)
.build());
}
}
variables:
testCompartment:
fn::invoke:
Function: oci:Identity:getCompartment
Arguments:
id: ${compartmentId}
Using getCompartment
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getCompartment(args: GetCompartmentArgs, opts?: InvokeOptions): Promise<GetCompartmentResult>
function getCompartmentOutput(args: GetCompartmentOutputArgs, opts?: InvokeOptions): Output<GetCompartmentResult>
def get_compartment(id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetCompartmentResult
def get_compartment_output(id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCompartmentResult]
func GetCompartment(ctx *Context, args *GetCompartmentArgs, opts ...InvokeOption) (*GetCompartmentResult, error)
func GetCompartmentOutput(ctx *Context, args *GetCompartmentOutputArgs, opts ...InvokeOption) GetCompartmentResultOutput
> Note: This function is named GetCompartment
in the Go SDK.
public static class GetCompartment
{
public static Task<GetCompartmentResult> InvokeAsync(GetCompartmentArgs args, InvokeOptions? opts = null)
public static Output<GetCompartmentResult> Invoke(GetCompartmentInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCompartmentResult> getCompartment(GetCompartmentArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: oci:Identity/getCompartment:getCompartment
arguments:
# arguments dictionary
The following arguments are supported:
- Id string
- The OCID of the compartment.
- Id string
- The OCID of the compartment.
- id String
- The OCID of the compartment.
- id string
- The OCID of the compartment.
- id str
- The OCID of the compartment.
- id String
- The OCID of the compartment.
getCompartment Result
The following output properties are available:
- Compartment
Id string - The OCID of the parent compartment containing the compartment.
- Dictionary<string, object>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- Description string
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- Dictionary<string, object>
- 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"}
- Id string
- The OCID of the compartment.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- Is
Accessible bool - 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).
- Name string
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- State string
- The compartment's current state.
- Time
Created string - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- Compartment
Id string - The OCID of the parent compartment containing the compartment.
- map[string]interface{}
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- Description string
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- map[string]interface{}
- 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"}
- Id string
- The OCID of the compartment.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- Is
Accessible bool - 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).
- Name string
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- State string
- The compartment's current state.
- Time
Created string - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- compartment
Id String - The OCID of the parent compartment containing the compartment.
- Map<String,Object>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- description String
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- Map<String,Object>
- 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"}
- id String
- The OCID of the compartment.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- is
Accessible 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).
- name String
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- state String
- The compartment's current state.
- time
Created String - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- compartment
Id string - The OCID of the parent compartment containing the compartment.
- {[key: string]: any}
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- description string
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- {[key: string]: any}
- 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"}
- id string
- The OCID of the compartment.
- inactive
State string - The detailed status of INACTIVE lifecycleState.
- is
Accessible 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).
- name string
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- state string
- The compartment's current state.
- time
Created string - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- compartment_
id str - The OCID of the parent compartment containing the compartment.
- Mapping[str, Any]
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- description str
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- Mapping[str, Any]
- 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"}
- id str
- The OCID of the compartment.
- inactive_
state str - The detailed status of INACTIVE lifecycleState.
- is_
accessible bool - 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).
- name str
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- state str
- The compartment's current state.
- time_
created str - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- compartment
Id String - The OCID of the parent compartment containing the compartment.
- Map<Any>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:
{"Operations.CostCenter": "42"}
- description String
- The description you assign to the compartment. Does not have to be unique, and it's changeable.
- Map<Any>
- 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"}
- id String
- The OCID of the compartment.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- is
Accessible 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).
- name String
- The name you assign to the compartment during creation. The name must be unique across all compartments in the parent. Avoid entering confidential information.
- state String
- The compartment's current state.
- time
Created String - Date and time the compartment was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
oci
Terraform Provider.