oci.Identity.getPolicies
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testPolicies = oci.Identity.getPolicies({
compartmentId: tenancyOcid,
name: policyName,
state: policyState,
});
import pulumi
import pulumi_oci as oci
test_policies = oci.Identity.get_policies(compartment_id=tenancy_ocid,
name=policy_name,
state=policy_state)
package main
import (
"github.com/pulumi/pulumi-oci/sdk/v2/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: tenancyOcid,
Name: pulumi.StringRef(policyName),
State: pulumi.StringRef(policyState),
}, 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 testPolicies = Oci.Identity.GetPolicies.Invoke(new()
{
CompartmentId = tenancyOcid,
Name = policyName,
State = policyState,
});
});
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.GetPoliciesArgs;
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 testPolicies = IdentityFunctions.getPolicies(GetPoliciesArgs.builder()
.compartmentId(tenancyOcid)
.name(policyName)
.state(policyState)
.build());
}
}
variables:
testPolicies:
fn::invoke:
Function: oci:Identity:getPolicies
Arguments:
compartmentId: ${tenancyOcid}
name: ${policyName}
state: ${policyState}
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:
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Filters
List<Get
Policies Filter> - 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 string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Filters
[]Get
Policies Filter - 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 String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- filters
List<Get
Policies Filter> - 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 string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- filters
Get
Policies Filter[] - 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
Sequence[identity.
Get Policies Filter] - 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.
- compartment
Id 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:
- Compartment
Id 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<Get
Policies Policy> - The list of policies.
- Filters
List<Get
Policies Filter> - 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 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
[]Get
Policies Policy - The list of policies.
- Filters
[]Get
Policies Filter - 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 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<Get
Policies Policy> - The list of policies.
- filters
List<Get
Policies Filter> - 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 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
Get
Policies Policy[] - The list of policies.
- filters
Get
Policies Filter[] - 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
Sequence[identity.
Get Policies Policy] - The list of policies.
- filters
Sequence[identity.
Get Policies Filter] - 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.
- compartment
Id 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
GetPoliciesPolicy
- Compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Dictionary<string, string>
- 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
- Dictionary<string, string>
- 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.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- Last
Update stringETag - Name string
- A filter to only return resources that match the given name exactly.
- Policy
Hash string - 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.
- Time
Created string - Date and time the policy was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- Version
Date 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 string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- map[string]string
- 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
- map[string]string
- 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.
- Inactive
State string - The detailed status of INACTIVE lifecycleState.
- Last
Update stringETag - Name string
- A filter to only return resources that match the given name exactly.
- Policy
Hash string - 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.
- Time
Created string - Date and time the policy was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- Version
Date 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
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Map<String,String>
- 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.
- Map<String,String>
- 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.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- last
Update StringETag - name String
- A filter to only return resources that match the given name exactly.
- policy
Hash String - 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.
- time
Created String - Date and time the policy was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- version
Date 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
- compartment
Id string - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- {[key: string]: string}
- 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.
- {[key: string]: string}
- 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.
- inactive
State string - The detailed status of INACTIVE lifecycleState.
- last
Update stringETag - name string
- A filter to only return resources that match the given name exactly.
- policy
Hash string - 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.
- time
Created string - Date and time the policy was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- version
Date 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).
- Mapping[str, str]
- 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 - Mapping[str, str]
- 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_ stre_ tag - name str
- A filter to only return resources that match the given name exactly.
- policy_
hash str - 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
- compartment
Id String - The OCID of the compartment (remember that the tenancy is simply the root compartment).
- Map<String>
- 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.
- Map<String>
- 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.
- inactive
State String - The detailed status of INACTIVE lifecycleState.
- last
Update StringETag - name String
- A filter to only return resources that match the given name exactly.
- policy
Hash String - 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.
- time
Created String - Date and time the policy was created, in the format defined by RFC3339. Example:
2016-08-25T21:10:29.600Z
- version
Date 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
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
oci
Terraform Provider.