1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. DataSafe
  5. getSecurityPolicies
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

oci.DataSafe.getSecurityPolicies

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

This data source provides the list of Security Policies in Oracle Cloud Infrastructure Data Safe service.

Retrieves a list of all security policies in Data Safe.

The ListSecurityPolicies operation returns only the security policies in the specified compartmentId.

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 (ACCESSIBLE) (the resource can be in a subcompartment) or to return Not Authorized if Principal doesn’t have access to even one of the child compartments. This is valid only when compartmentIdInSubtree is set to true.

The parameter compartmentIdInSubtree applies when you perform ListSecurityPolicies on the compartmentId passed and when it is 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 ACCESSIBLE.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testSecurityPolicies = oci.DataSafe.getSecurityPolicies({
    compartmentId: compartmentId,
    accessLevel: securityPolicyAccessLevel,
    compartmentIdInSubtree: securityPolicyCompartmentIdInSubtree,
    displayName: securityPolicyDisplayName,
    securityPolicyId: testSecurityPolicy.id,
    state: securityPolicyState,
});
Copy
import pulumi
import pulumi_oci as oci

test_security_policies = oci.DataSafe.get_security_policies(compartment_id=compartment_id,
    access_level=security_policy_access_level,
    compartment_id_in_subtree=security_policy_compartment_id_in_subtree,
    display_name=security_policy_display_name,
    security_policy_id=test_security_policy["id"],
    state=security_policy_state)
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/datasafe"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datasafe.GetSecurityPolicies(ctx, &datasafe.GetSecurityPoliciesArgs{
			CompartmentId:          compartmentId,
			AccessLevel:            pulumi.StringRef(securityPolicyAccessLevel),
			CompartmentIdInSubtree: pulumi.BoolRef(securityPolicyCompartmentIdInSubtree),
			DisplayName:            pulumi.StringRef(securityPolicyDisplayName),
			SecurityPolicyId:       pulumi.StringRef(testSecurityPolicy.Id),
			State:                  pulumi.StringRef(securityPolicyState),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testSecurityPolicies = Oci.DataSafe.GetSecurityPolicies.Invoke(new()
    {
        CompartmentId = compartmentId,
        AccessLevel = securityPolicyAccessLevel,
        CompartmentIdInSubtree = securityPolicyCompartmentIdInSubtree,
        DisplayName = securityPolicyDisplayName,
        SecurityPolicyId = testSecurityPolicy.Id,
        State = securityPolicyState,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.DataSafe.DataSafeFunctions;
import com.pulumi.oci.DataSafe.inputs.GetSecurityPoliciesArgs;
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 testSecurityPolicies = DataSafeFunctions.getSecurityPolicies(GetSecurityPoliciesArgs.builder()
            .compartmentId(compartmentId)
            .accessLevel(securityPolicyAccessLevel)
            .compartmentIdInSubtree(securityPolicyCompartmentIdInSubtree)
            .displayName(securityPolicyDisplayName)
            .securityPolicyId(testSecurityPolicy.id())
            .state(securityPolicyState)
            .build());

    }
}
Copy
variables:
  testSecurityPolicies:
    fn::invoke:
      function: oci:DataSafe:getSecurityPolicies
      arguments:
        compartmentId: ${compartmentId}
        accessLevel: ${securityPolicyAccessLevel}
        compartmentIdInSubtree: ${securityPolicyCompartmentIdInSubtree}
        displayName: ${securityPolicyDisplayName}
        securityPolicyId: ${testSecurityPolicy.id}
        state: ${securityPolicyState}
Copy

Using getSecurityPolicies

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 getSecurityPolicies(args: GetSecurityPoliciesArgs, opts?: InvokeOptions): Promise<GetSecurityPoliciesResult>
function getSecurityPoliciesOutput(args: GetSecurityPoliciesOutputArgs, opts?: InvokeOptions): Output<GetSecurityPoliciesResult>
Copy
def get_security_policies(access_level: Optional[str] = None,
                          compartment_id: Optional[str] = None,
                          compartment_id_in_subtree: Optional[bool] = None,
                          display_name: Optional[str] = None,
                          filters: Optional[Sequence[_datasafe.GetSecurityPoliciesFilter]] = None,
                          security_policy_id: Optional[str] = None,
                          state: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetSecurityPoliciesResult
def get_security_policies_output(access_level: Optional[pulumi.Input[str]] = None,
                          compartment_id: Optional[pulumi.Input[str]] = None,
                          compartment_id_in_subtree: Optional[pulumi.Input[bool]] = None,
                          display_name: Optional[pulumi.Input[str]] = None,
                          filters: Optional[pulumi.Input[Sequence[pulumi.Input[_datasafe.GetSecurityPoliciesFilterArgs]]]] = None,
                          security_policy_id: Optional[pulumi.Input[str]] = None,
                          state: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetSecurityPoliciesResult]
Copy
func GetSecurityPolicies(ctx *Context, args *GetSecurityPoliciesArgs, opts ...InvokeOption) (*GetSecurityPoliciesResult, error)
func GetSecurityPoliciesOutput(ctx *Context, args *GetSecurityPoliciesOutputArgs, opts ...InvokeOption) GetSecurityPoliciesResultOutput
Copy

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

public static class GetSecurityPolicies 
{
    public static Task<GetSecurityPoliciesResult> InvokeAsync(GetSecurityPoliciesArgs args, InvokeOptions? opts = null)
    public static Output<GetSecurityPoliciesResult> Invoke(GetSecurityPoliciesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecurityPoliciesResult> getSecurityPolicies(GetSecurityPoliciesArgs args, InvokeOptions options)
public static Output<GetSecurityPoliciesResult> getSecurityPolicies(GetSecurityPoliciesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:DataSafe/getSecurityPolicies:getSecurityPolicies
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
AccessLevel string
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
CompartmentIdInSubtree bool
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
DisplayName string
A filter to return only resources that match the specified display name.
Filters Changes to this property will trigger replacement. List<GetSecurityPoliciesFilter>
SecurityPolicyId string
An optional filter to return only resources that match the specified OCID of the security policy resource.
State string
The current state of the security policy.
CompartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
AccessLevel string
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
CompartmentIdInSubtree bool
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
DisplayName string
A filter to return only resources that match the specified display name.
Filters Changes to this property will trigger replacement. []GetSecurityPoliciesFilter
SecurityPolicyId string
An optional filter to return only resources that match the specified OCID of the security policy resource.
State string
The current state of the security policy.
compartmentId This property is required. String
A filter to return only resources that match the specified compartment OCID.
accessLevel String
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
compartmentIdInSubtree Boolean
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
displayName String
A filter to return only resources that match the specified display name.
filters Changes to this property will trigger replacement. List<GetSecurityPoliciesFilter>
securityPolicyId String
An optional filter to return only resources that match the specified OCID of the security policy resource.
state String
The current state of the security policy.
compartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
accessLevel string
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
compartmentIdInSubtree boolean
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
displayName string
A filter to return only resources that match the specified display name.
filters Changes to this property will trigger replacement. GetSecurityPoliciesFilter[]
securityPolicyId string
An optional filter to return only resources that match the specified OCID of the security policy resource.
state string
The current state of the security policy.
compartment_id This property is required. str
A filter to return only resources that match the specified compartment OCID.
access_level str
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
compartment_id_in_subtree bool
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
display_name str
A filter to return only resources that match the specified display name.
filters Changes to this property will trigger replacement. Sequence[datasafe.GetSecurityPoliciesFilter]
security_policy_id str
An optional filter to return only resources that match the specified OCID of the security policy resource.
state str
The current state of the security policy.
compartmentId This property is required. String
A filter to return only resources that match the specified compartment OCID.
accessLevel String
Valid values are RESTRICTED and ACCESSIBLE. Default is RESTRICTED. 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). When set to RESTRICTED permissions are checked and no partial results are displayed.
compartmentIdInSubtree Boolean
Default is false. When set to true, the hierarchy of compartments is traversed and all compartments and subcompartments in the tenancy are returned. Depends on the 'accessLevel' setting.
displayName String
A filter to return only resources that match the specified display name.
filters Changes to this property will trigger replacement. List<Property Map>
securityPolicyId String
An optional filter to return only resources that match the specified OCID of the security policy resource.
state String
The current state of the security policy.

getSecurityPolicies Result

The following output properties are available:

CompartmentId string
The OCID of the compartment containing the security policy.
Id string
The provider-assigned unique ID for this managed resource.
SecurityPolicyCollections List<GetSecurityPoliciesSecurityPolicyCollection>
The list of security_policy_collection.
AccessLevel string
CompartmentIdInSubtree bool
DisplayName string
The display name of the security policy.
Filters List<GetSecurityPoliciesFilter>
SecurityPolicyId string
State string
The current state of the security policy.
CompartmentId string
The OCID of the compartment containing the security policy.
Id string
The provider-assigned unique ID for this managed resource.
SecurityPolicyCollections []GetSecurityPoliciesSecurityPolicyCollection
The list of security_policy_collection.
AccessLevel string
CompartmentIdInSubtree bool
DisplayName string
The display name of the security policy.
Filters []GetSecurityPoliciesFilter
SecurityPolicyId string
State string
The current state of the security policy.
compartmentId String
The OCID of the compartment containing the security policy.
id String
The provider-assigned unique ID for this managed resource.
securityPolicyCollections List<GetSecurityPoliciesSecurityPolicyCollection>
The list of security_policy_collection.
accessLevel String
compartmentIdInSubtree Boolean
displayName String
The display name of the security policy.
filters List<GetSecurityPoliciesFilter>
securityPolicyId String
state String
The current state of the security policy.
compartmentId string
The OCID of the compartment containing the security policy.
id string
The provider-assigned unique ID for this managed resource.
securityPolicyCollections GetSecurityPoliciesSecurityPolicyCollection[]
The list of security_policy_collection.
accessLevel string
compartmentIdInSubtree boolean
displayName string
The display name of the security policy.
filters GetSecurityPoliciesFilter[]
securityPolicyId string
state string
The current state of the security policy.
compartment_id str
The OCID of the compartment containing the security policy.
id str
The provider-assigned unique ID for this managed resource.
security_policy_collections Sequence[datasafe.GetSecurityPoliciesSecurityPolicyCollection]
The list of security_policy_collection.
access_level str
compartment_id_in_subtree bool
display_name str
The display name of the security policy.
filters Sequence[datasafe.GetSecurityPoliciesFilter]
security_policy_id str
state str
The current state of the security policy.
compartmentId String
The OCID of the compartment containing the security policy.
id String
The provider-assigned unique ID for this managed resource.
securityPolicyCollections List<Property Map>
The list of security_policy_collection.
accessLevel String
compartmentIdInSubtree Boolean
displayName String
The display name of the security policy.
filters List<Property Map>
securityPolicyId String
state String
The current state of the security policy.

Supporting Types

GetSecurityPoliciesFilter

Name This property is required. string
Values This property is required. List<string>
Regex bool
Name This property is required. string
Values This property is required. []string
Regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean
name This property is required. string
values This property is required. string[]
regex boolean
name This property is required. str
values This property is required. Sequence[str]
regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean

GetSecurityPoliciesSecurityPolicyCollection

items This property is required. List<Property Map>

GetSecurityPoliciesSecurityPolicyCollectionItem

CompartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
DefinedTags This property is required. 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 This property is required. string
The description of the security policy.
DisplayName This property is required. string
A filter to return only resources that match the specified display name.
FreeformTags This property is required. 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 This property is required. string
The OCID of the security policy.
LifecycleDetails This property is required. string
Details about the current state of the security policy in Data Safe.
SecurityPolicyId This property is required. string
An optional filter to return only resources that match the specified OCID of the security policy resource.
State This property is required. string
The current state of the security policy.
SystemTags This property is required. Dictionary<string, string>
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
TimeCreated This property is required. string
The time that the security policy was created, in the format defined by RFC3339.
TimeUpdated This property is required. string
The last date and time the security policy was updated, in the format defined by RFC3339.
CompartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
DefinedTags This property is required. 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 This property is required. string
The description of the security policy.
DisplayName This property is required. string
A filter to return only resources that match the specified display name.
FreeformTags This property is required. 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 This property is required. string
The OCID of the security policy.
LifecycleDetails This property is required. string
Details about the current state of the security policy in Data Safe.
SecurityPolicyId This property is required. string
An optional filter to return only resources that match the specified OCID of the security policy resource.
State This property is required. string
The current state of the security policy.
SystemTags This property is required. map[string]string
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
TimeCreated This property is required. string
The time that the security policy was created, in the format defined by RFC3339.
TimeUpdated This property is required. string
The last date and time the security policy was updated, in the format defined by RFC3339.
compartmentId This property is required. String
A filter to return only resources that match the specified compartment OCID.
definedTags This property is required. 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 This property is required. String
The description of the security policy.
displayName This property is required. String
A filter to return only resources that match the specified display name.
freeformTags This property is required. 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 This property is required. String
The OCID of the security policy.
lifecycleDetails This property is required. String
Details about the current state of the security policy in Data Safe.
securityPolicyId This property is required. String
An optional filter to return only resources that match the specified OCID of the security policy resource.
state This property is required. String
The current state of the security policy.
systemTags This property is required. Map<String,String>
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
timeCreated This property is required. String
The time that the security policy was created, in the format defined by RFC3339.
timeUpdated This property is required. String
The last date and time the security policy was updated, in the format defined by RFC3339.
compartmentId This property is required. string
A filter to return only resources that match the specified compartment OCID.
definedTags This property is required. {[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 This property is required. string
The description of the security policy.
displayName This property is required. string
A filter to return only resources that match the specified display name.
freeformTags This property is required. {[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 This property is required. string
The OCID of the security policy.
lifecycleDetails This property is required. string
Details about the current state of the security policy in Data Safe.
securityPolicyId This property is required. string
An optional filter to return only resources that match the specified OCID of the security policy resource.
state This property is required. string
The current state of the security policy.
systemTags This property is required. {[key: string]: string}
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
timeCreated This property is required. string
The time that the security policy was created, in the format defined by RFC3339.
timeUpdated This property is required. string
The last date and time the security policy was updated, in the format defined by RFC3339.
compartment_id This property is required. str
A filter to return only resources that match the specified compartment OCID.
defined_tags This property is required. 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 This property is required. str
The description of the security policy.
display_name This property is required. str
A filter to return only resources that match the specified display name.
freeform_tags This property is required. 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 This property is required. str
The OCID of the security policy.
lifecycle_details This property is required. str
Details about the current state of the security policy in Data Safe.
security_policy_id This property is required. str
An optional filter to return only resources that match the specified OCID of the security policy resource.
state This property is required. str
The current state of the security policy.
system_tags This property is required. Mapping[str, str]
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
time_created This property is required. str
The time that the security policy was created, in the format defined by RFC3339.
time_updated This property is required. str
The last date and time the security policy was updated, in the format defined by RFC3339.
compartmentId This property is required. String
A filter to return only resources that match the specified compartment OCID.
definedTags This property is required. 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 This property is required. String
The description of the security policy.
displayName This property is required. String
A filter to return only resources that match the specified display name.
freeformTags This property is required. 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 This property is required. String
The OCID of the security policy.
lifecycleDetails This property is required. String
Details about the current state of the security policy in Data Safe.
securityPolicyId This property is required. String
An optional filter to return only resources that match the specified OCID of the security policy resource.
state This property is required. String
The current state of the security policy.
systemTags This property is required. Map<String>
System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"orcl-cloud.free-tier-retained": "true"}
timeCreated This property is required. String
The time that the security policy was created, in the format defined by RFC3339.
timeUpdated This property is required. String
The last date and time the security policy was updated, in the format defined by RFC3339.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi