Oracle Cloud Infrastructure
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:
- 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
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
Get
Policies Policy] The list of policies.
- filters
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, 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
The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- 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.
- Inactive
State string The detailed status of INACTIVE lifecycleState.
- Last
Update stringETag 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.
- Policy
Hash string 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.
- 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]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
The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- 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.
- Inactive
State string The detailed status of INACTIVE lifecycleState.
- Last
Update stringETag 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.
- Policy
Hash string 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.
- 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
The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- compartment
Id String The OCID of the compartment (remember that the tenancy is simply the root 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 policy. 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 policy.
- inactive
State String The detailed status of INACTIVE lifecycleState.
- last
Update StringETag 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.
- policy
Hash String 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.
- 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
The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- compartment
Id string The OCID of the compartment (remember that the tenancy is simply the root 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 policy. 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 policy.
- inactive
State string The detailed status of INACTIVE lifecycleState.
- last
Update stringETag 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.
- policy
Hash string 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.
- 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, 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 The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- 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_ stre_ tag 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 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
The 'ETag' field has been deprecated and may be removed in a future version. Do not use this field.
- compartment
Id String The OCID of the compartment (remember that the tenancy is simply the root 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 policy. 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 policy.
- inactive
State String The detailed status of INACTIVE lifecycleState.
- last
Update StringETag 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.
- policy
Hash String 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.
- 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
- https://github.com/pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
oci
Terraform Provider.