Oracle Cloud Infrastructure

Pulumi Official
Package maintained by Pulumi
v0.1.1 published on Tuesday, May 3, 2022 by Pulumi

getPolicies

This data source provides the list of Policies in Oracle Cloud Infrastructure Identity service.

Lists the policies in the specified compartment (either the tenancy or another of your compartments). See Where to Get the Tenancy’s OCID and User’s OCID.

To determine which policies apply to a particular group or compartment, you must view the individual statements inside all your policies. There isn’t a way to automatically obtain that information via the API.

Example Usage

using Pulumi;
using Oci = Pulumi.Oci;

class MyStack : Stack
{
    public MyStack()
    {
        var testPolicies = Output.Create(Oci.Identity.GetPolicies.InvokeAsync(new Oci.Identity.GetPoliciesArgs
        {
            CompartmentId = @var.Tenancy_ocid,
            Name = @var.Policy_name,
            State = @var.Policy_state,
        }));
    }

}
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.GetPolicies(ctx, &identity.GetPoliciesArgs{
			CompartmentId: _var.Tenancy_ocid,
			Name:          pulumi.StringRef(_var.Policy_name),
			State:         pulumi.StringRef(_var.Policy_state),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_oci as oci

test_policies = oci.Identity.get_policies(compartment_id=var["tenancy_ocid"],
    name=var["policy_name"],
    state=var["policy_state"])
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testPolicies = oci.Identity.getPolicies({
    compartmentId: _var.tenancy_ocid,
    name: _var.policy_name,
    state: _var.policy_state,
});

Coming soon!

Using getPolicies

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 getPolicies(args: GetPoliciesArgs, opts?: InvokeOptions): Promise<GetPoliciesResult>
function getPoliciesOutput(args: GetPoliciesOutputArgs, opts?: InvokeOptions): Output<GetPoliciesResult>
def get_policies(compartment_id: Optional[str] = None,
                 filters: Optional[Sequence[_identity.GetPoliciesFilter]] = None,
                 name: Optional[str] = None,
                 state: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetPoliciesResult
def get_policies_output(compartment_id: Optional[pulumi.Input[str]] = None,
                 filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetPoliciesFilterArgs]]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetPoliciesResult]
func GetPolicies(ctx *Context, args *GetPoliciesArgs, opts ...InvokeOption) (*GetPoliciesResult, error)
func GetPoliciesOutput(ctx *Context, args *GetPoliciesOutputArgs, opts ...InvokeOption) GetPoliciesResultOutput

> Note: This function is named GetPolicies in the Go SDK.

public static class GetPolicies 
{
    public static Task<GetPoliciesResult> InvokeAsync(GetPoliciesArgs args, InvokeOptions? opts = null)
    public static Output<GetPoliciesResult> Invoke(GetPoliciesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: oci:Identity/getPolicies:getPolicies
  Arguments:
    # Arguments dictionary

The following arguments are supported:

CompartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

Filters List<GetPoliciesFilter>
Name string

A filter to only return resources that match the given name exactly.

State string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

CompartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

Filters []GetPoliciesFilter
Name string

A filter to only return resources that match the given name exactly.

State string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

compartmentId String

The OCID of the compartment (remember that the tenancy is simply the root compartment).

filters List<GetPoliciesFilter>
name String

A filter to only return resources that match the given name exactly.

state String

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

compartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

filters GetPoliciesFilter[]
name string

A filter to only return resources that match the given name exactly.

state string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

compartment_id str

The OCID of the compartment (remember that the tenancy is simply the root compartment).

filters GetPoliciesFilter]
name str

A filter to only return resources that match the given name exactly.

state str

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

compartmentId String

The OCID of the compartment (remember that the tenancy is simply the root compartment).

filters List<Property Map>
name String

A filter to only return resources that match the given name exactly.

state String

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

getPolicies Result

The following output properties are available:

CompartmentId string

The OCID of the compartment containing the policy (either the tenancy or another compartment).

Id string

The provider-assigned unique ID for this managed resource.

Policies List<GetPoliciesPolicy>

The list of policies.

Filters List<GetPoliciesFilter>
Name string

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

State string

The policy's current state.

CompartmentId string

The OCID of the compartment containing the policy (either the tenancy or another compartment).

Id string

The provider-assigned unique ID for this managed resource.

Policies []GetPoliciesPolicy

The list of policies.

Filters []GetPoliciesFilter
Name string

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

State string

The policy's current state.

compartmentId String

The OCID of the compartment containing the policy (either the tenancy or another compartment).

id String

The provider-assigned unique ID for this managed resource.

policies List<GetPoliciesPolicy>

The list of policies.

filters List<GetPoliciesFilter>
name String

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

state String

The policy's current state.

compartmentId string

The OCID of the compartment containing the policy (either the tenancy or another compartment).

id string

The provider-assigned unique ID for this managed resource.

policies GetPoliciesPolicy[]

The list of policies.

filters GetPoliciesFilter[]
name string

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

state string

The policy's current state.

compartment_id str

The OCID of the compartment containing the policy (either the tenancy or another compartment).

id str

The provider-assigned unique ID for this managed resource.

policies GetPoliciesPolicy]

The list of policies.

filters GetPoliciesFilter]
name str

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

state str

The policy's current state.

compartmentId String

The OCID of the compartment containing the policy (either the tenancy or another compartment).

id String

The provider-assigned unique ID for this managed resource.

policies List<Property Map>

The list of policies.

filters List<Property Map>
name String

The name you assign to the policy during creation. The name must be unique across all policies in the tenancy and cannot be changed.

state String

The policy's current state.

Supporting Types

GetPoliciesFilter

Name string

A filter to only return resources that match the given name exactly.

Values List<string>
Regex bool
Name string

A filter to only return resources that match the given name exactly.

Values []string
Regex bool
name String

A filter to only return resources that match the given name exactly.

values List<String>
regex Boolean
name string

A filter to only return resources that match the given name exactly.

values string[]
regex boolean
name str

A filter to only return resources that match the given name exactly.

values Sequence[str]
regex bool
name String

A filter to only return resources that match the given name exactly.

values List<String>
regex Boolean

GetPoliciesPolicy

CompartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

DefinedTags 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 policy. Does not have to be unique, and it's changeable.

ETag string

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

FreeformTags 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 policy.

InactiveState string

The detailed status of INACTIVE lifecycleState.

LastUpdateETag string

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

Name string

A filter to only return resources that match the given name exactly.

PolicyHash string

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

State string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

Statements List<string>

An array of one or more policy statements written in the policy language.

TimeCreated string

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

VersionDate string

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

CompartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

DefinedTags 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 policy. Does not have to be unique, and it's changeable.

ETag string

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

FreeformTags 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 policy.

InactiveState string

The detailed status of INACTIVE lifecycleState.

LastUpdateETag string

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

Name string

A filter to only return resources that match the given name exactly.

PolicyHash string

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

State string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

Statements []string

An array of one or more policy statements written in the policy language.

TimeCreated string

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

VersionDate string

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

ETag String

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

compartmentId String

The OCID of the compartment (remember that the tenancy is simply the root compartment).

definedTags 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 policy. Does not have to be unique, and it's changeable.

freeformTags 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 policy.

inactiveState String

The detailed status of INACTIVE lifecycleState.

lastUpdateETag String

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

name String

A filter to only return resources that match the given name exactly.

policyHash String

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

state String

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

statements List<String>

An array of one or more policy statements written in the policy language.

timeCreated String

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

versionDate String

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

ETag string

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

compartmentId string

The OCID of the compartment (remember that the tenancy is simply the root compartment).

definedTags {[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 policy. Does not have to be unique, and it's changeable.

freeformTags {[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 policy.

inactiveState string

The detailed status of INACTIVE lifecycleState.

lastUpdateETag string

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

name string

A filter to only return resources that match the given name exactly.

policyHash string

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

state string

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

statements string[]

An array of one or more policy statements written in the policy language.

timeCreated string

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

versionDate string

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

compartment_id str

The OCID of the compartment (remember that the tenancy is simply the root compartment).

defined_tags 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 policy. Does not have to be unique, and it's changeable.

e_tag str

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

freeform_tags 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 policy.

inactive_state str

The detailed status of INACTIVE lifecycleState.

last_update_e_tag str

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

name str

A filter to only return resources that match the given name exactly.

policy_hash str

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

state str

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

statements Sequence[str]

An array of one or more policy statements written in the policy language.

time_created str

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

version_date str

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

ETag String

Deprecated:

The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.

compartmentId String

The OCID of the compartment (remember that the tenancy is simply the root compartment).

definedTags 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 policy. Does not have to be unique, and it's changeable.

freeformTags 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 policy.

inactiveState String

The detailed status of INACTIVE lifecycleState.

lastUpdateETag String

Deprecated:

The 'lastUpdateETag' field has been deprecated and may be removed in a future version. Do not use this field.

name String

A filter to only return resources that match the given name exactly.

policyHash String

Deprecated:

The 'policyHash' field has been deprecated and may be removed in a future version. Do not use this field.

state String

A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

statements List<String>

An array of one or more policy statements written in the policy language.

timeCreated String

Date and time the policy was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

versionDate String

The version of the policy. If null or set to an empty string, when a request comes in for authorization, the policy will be evaluated according to the current behavior of the services at that moment. If set to a particular date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date.

Package Details

Repository
https://github.com/pulumi/pulumi-oci
License
Apache-2.0
Notes

This Pulumi package is based on the oci Terraform Provider.