1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. RecoveryMod
  5. getProtectionPolicies
Oracle Cloud Infrastructure v2.28.0 published on Thursday, Mar 27, 2025 by Pulumi

oci.RecoveryMod.getProtectionPolicies

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.28.0 published on Thursday, Mar 27, 2025 by Pulumi

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

Gets a list of protection policies based on the specified parameters.

Example Usage

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

const testProtectionPolicies = oci.RecoveryMod.getProtectionPolicies({
    compartmentId: compartmentId,
    displayName: protectionPolicyDisplayName,
    owner: protectionPolicyOwner,
    protectionPolicyId: testProtectionPolicy.id,
    state: protectionPolicyState,
});
Copy
import pulumi
import pulumi_oci as oci

test_protection_policies = oci.RecoveryMod.get_protection_policies(compartment_id=compartment_id,
    display_name=protection_policy_display_name,
    owner=protection_policy_owner,
    protection_policy_id=test_protection_policy["id"],
    state=protection_policy_state)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := recoverymod.GetProtectionPolicies(ctx, &recoverymod.GetProtectionPoliciesArgs{
			CompartmentId:      compartmentId,
			DisplayName:        pulumi.StringRef(protectionPolicyDisplayName),
			Owner:              pulumi.StringRef(protectionPolicyOwner),
			ProtectionPolicyId: pulumi.StringRef(testProtectionPolicy.Id),
			State:              pulumi.StringRef(protectionPolicyState),
		}, 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 testProtectionPolicies = Oci.RecoveryMod.GetProtectionPolicies.Invoke(new()
    {
        CompartmentId = compartmentId,
        DisplayName = protectionPolicyDisplayName,
        Owner = protectionPolicyOwner,
        ProtectionPolicyId = testProtectionPolicy.Id,
        State = protectionPolicyState,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.RecoveryMod.RecoveryModFunctions;
import com.pulumi.oci.RecoveryMod.inputs.GetProtectionPoliciesArgs;
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 testProtectionPolicies = RecoveryModFunctions.getProtectionPolicies(GetProtectionPoliciesArgs.builder()
            .compartmentId(compartmentId)
            .displayName(protectionPolicyDisplayName)
            .owner(protectionPolicyOwner)
            .protectionPolicyId(testProtectionPolicy.id())
            .state(protectionPolicyState)
            .build());

    }
}
Copy
variables:
  testProtectionPolicies:
    fn::invoke:
      function: oci:RecoveryMod:getProtectionPolicies
      arguments:
        compartmentId: ${compartmentId}
        displayName: ${protectionPolicyDisplayName}
        owner: ${protectionPolicyOwner}
        protectionPolicyId: ${testProtectionPolicy.id}
        state: ${protectionPolicyState}
Copy

Using getProtectionPolicies

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 getProtectionPolicies(args: GetProtectionPoliciesArgs, opts?: InvokeOptions): Promise<GetProtectionPoliciesResult>
function getProtectionPoliciesOutput(args: GetProtectionPoliciesOutputArgs, opts?: InvokeOptions): Output<GetProtectionPoliciesResult>
Copy
def get_protection_policies(compartment_id: Optional[str] = None,
                            display_name: Optional[str] = None,
                            filters: Optional[Sequence[_recoverymod.GetProtectionPoliciesFilter]] = None,
                            owner: Optional[str] = None,
                            protection_policy_id: Optional[str] = None,
                            state: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetProtectionPoliciesResult
def get_protection_policies_output(compartment_id: Optional[pulumi.Input[str]] = None,
                            display_name: Optional[pulumi.Input[str]] = None,
                            filters: Optional[pulumi.Input[Sequence[pulumi.Input[_recoverymod.GetProtectionPoliciesFilterArgs]]]] = None,
                            owner: Optional[pulumi.Input[str]] = None,
                            protection_policy_id: Optional[pulumi.Input[str]] = None,
                            state: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetProtectionPoliciesResult]
Copy
func GetProtectionPolicies(ctx *Context, args *GetProtectionPoliciesArgs, opts ...InvokeOption) (*GetProtectionPoliciesResult, error)
func GetProtectionPoliciesOutput(ctx *Context, args *GetProtectionPoliciesOutputArgs, opts ...InvokeOption) GetProtectionPoliciesResultOutput
Copy

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

public static class GetProtectionPolicies 
{
    public static Task<GetProtectionPoliciesResult> InvokeAsync(GetProtectionPoliciesArgs args, InvokeOptions? opts = null)
    public static Output<GetProtectionPoliciesResult> Invoke(GetProtectionPoliciesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProtectionPoliciesResult> getProtectionPolicies(GetProtectionPoliciesArgs args, InvokeOptions options)
public static Output<GetProtectionPoliciesResult> getProtectionPolicies(GetProtectionPoliciesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:RecoveryMod/getProtectionPolicies:getProtectionPolicies
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
The compartment OCID.
DisplayName string
A filter to return only resources that match the entire 'displayname' given.
Filters Changes to this property will trigger replacement. List<GetProtectionPoliciesFilter>
Owner string
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
ProtectionPolicyId string
The protection policy OCID.
State string
A filter to return only resources their lifecycleState matches the given lifecycleState.
CompartmentId This property is required. string
The compartment OCID.
DisplayName string
A filter to return only resources that match the entire 'displayname' given.
Filters Changes to this property will trigger replacement. []GetProtectionPoliciesFilter
Owner string
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
ProtectionPolicyId string
The protection policy OCID.
State string
A filter to return only resources their lifecycleState matches the given lifecycleState.
compartmentId This property is required. String
The compartment OCID.
displayName String
A filter to return only resources that match the entire 'displayname' given.
filters Changes to this property will trigger replacement. List<GetProtectionPoliciesFilter>
owner String
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
protectionPolicyId String
The protection policy OCID.
state String
A filter to return only resources their lifecycleState matches the given lifecycleState.
compartmentId This property is required. string
The compartment OCID.
displayName string
A filter to return only resources that match the entire 'displayname' given.
filters Changes to this property will trigger replacement. GetProtectionPoliciesFilter[]
owner string
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
protectionPolicyId string
The protection policy OCID.
state string
A filter to return only resources their lifecycleState matches the given lifecycleState.
compartment_id This property is required. str
The compartment OCID.
display_name str
A filter to return only resources that match the entire 'displayname' given.
filters Changes to this property will trigger replacement. Sequence[recoverymod.GetProtectionPoliciesFilter]
owner str
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
protection_policy_id str
The protection policy OCID.
state str
A filter to return only resources their lifecycleState matches the given lifecycleState.
compartmentId This property is required. String
The compartment OCID.
displayName String
A filter to return only resources that match the entire 'displayname' given.
filters Changes to this property will trigger replacement. List<Property Map>
owner String
A filter to return only the policies that match the owner as 'Customer' or 'Oracle'.
protectionPolicyId String
The protection policy OCID.
state String
A filter to return only resources their lifecycleState matches the given lifecycleState.

getProtectionPolicies Result

The following output properties are available:

CompartmentId string
The OCID of the compartment that contains the protection policy.
Id string
The provider-assigned unique ID for this managed resource.
ProtectionPolicyCollections List<GetProtectionPoliciesProtectionPolicyCollection>
The list of protection_policy_collection.
DisplayName string
A user provided name for the protection policy.
Filters List<GetProtectionPoliciesFilter>
Owner string
ProtectionPolicyId string
State string
The current state of the protection policy.
CompartmentId string
The OCID of the compartment that contains the protection policy.
Id string
The provider-assigned unique ID for this managed resource.
ProtectionPolicyCollections []GetProtectionPoliciesProtectionPolicyCollection
The list of protection_policy_collection.
DisplayName string
A user provided name for the protection policy.
Filters []GetProtectionPoliciesFilter
Owner string
ProtectionPolicyId string
State string
The current state of the protection policy.
compartmentId String
The OCID of the compartment that contains the protection policy.
id String
The provider-assigned unique ID for this managed resource.
protectionPolicyCollections List<GetProtectionPoliciesProtectionPolicyCollection>
The list of protection_policy_collection.
displayName String
A user provided name for the protection policy.
filters List<GetProtectionPoliciesFilter>
owner String
protectionPolicyId String
state String
The current state of the protection policy.
compartmentId string
The OCID of the compartment that contains the protection policy.
id string
The provider-assigned unique ID for this managed resource.
protectionPolicyCollections GetProtectionPoliciesProtectionPolicyCollection[]
The list of protection_policy_collection.
displayName string
A user provided name for the protection policy.
filters GetProtectionPoliciesFilter[]
owner string
protectionPolicyId string
state string
The current state of the protection policy.
compartment_id str
The OCID of the compartment that contains the protection policy.
id str
The provider-assigned unique ID for this managed resource.
protection_policy_collections Sequence[recoverymod.GetProtectionPoliciesProtectionPolicyCollection]
The list of protection_policy_collection.
display_name str
A user provided name for the protection policy.
filters Sequence[recoverymod.GetProtectionPoliciesFilter]
owner str
protection_policy_id str
state str
The current state of the protection policy.
compartmentId String
The OCID of the compartment that contains the protection policy.
id String
The provider-assigned unique ID for this managed resource.
protectionPolicyCollections List<Property Map>
The list of protection_policy_collection.
displayName String
A user provided name for the protection policy.
filters List<Property Map>
owner String
protectionPolicyId String
state String
The current state of the protection policy.

Supporting Types

GetProtectionPoliciesFilter

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

GetProtectionPoliciesProtectionPolicyCollection

items This property is required. List<Property Map>

GetProtectionPoliciesProtectionPolicyCollectionItem

BackupRetentionPeriodInDays This property is required. int
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
CompartmentId This property is required. string
The compartment OCID.
DefinedTags This property is required. Dictionary<string, string>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
DisplayName This property is required. string
A filter to return only resources that match the entire 'displayname' given.
FreeformTags This property is required. Dictionary<string, string>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
Id This property is required. string
The protection policy OCID.
IsPredefinedPolicy This property is required. bool
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
LifecycleDetails This property is required. string
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
MustEnforceCloudLocality This property is required. bool
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
PolicyLockedDateTime This property is required. string
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
State This property is required. string
A filter to return only resources their lifecycleState matches the given lifecycleState.
SystemTags This property is required. Dictionary<string, string>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
TimeCreated This property is required. string
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
TimeUpdated This property is required. string
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
BackupRetentionPeriodInDays This property is required. int
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
CompartmentId This property is required. string
The compartment OCID.
DefinedTags This property is required. map[string]string
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
DisplayName This property is required. string
A filter to return only resources that match the entire 'displayname' given.
FreeformTags This property is required. map[string]string
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
Id This property is required. string
The protection policy OCID.
IsPredefinedPolicy This property is required. bool
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
LifecycleDetails This property is required. string
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
MustEnforceCloudLocality This property is required. bool
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
PolicyLockedDateTime This property is required. string
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
State This property is required. string
A filter to return only resources their lifecycleState matches the given lifecycleState.
SystemTags This property is required. map[string]string
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
TimeCreated This property is required. string
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
TimeUpdated This property is required. string
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
backupRetentionPeriodInDays This property is required. Integer
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
compartmentId This property is required. String
The compartment OCID.
definedTags This property is required. Map<String,String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
displayName This property is required. String
A filter to return only resources that match the entire 'displayname' given.
freeformTags This property is required. Map<String,String>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. String
The protection policy OCID.
isPredefinedPolicy This property is required. Boolean
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
lifecycleDetails This property is required. String
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
mustEnforceCloudLocality This property is required. Boolean
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
policyLockedDateTime This property is required. String
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
state This property is required. String
A filter to return only resources their lifecycleState matches the given lifecycleState.
systemTags This property is required. Map<String,String>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
timeCreated This property is required. String
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
timeUpdated This property is required. String
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
backupRetentionPeriodInDays This property is required. number
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
compartmentId This property is required. string
The compartment OCID.
definedTags This property is required. {[key: string]: string}
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
displayName This property is required. string
A filter to return only resources that match the entire 'displayname' given.
freeformTags This property is required. {[key: string]: string}
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. string
The protection policy OCID.
isPredefinedPolicy This property is required. boolean
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
lifecycleDetails This property is required. string
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
mustEnforceCloudLocality This property is required. boolean
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
policyLockedDateTime This property is required. string
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
state This property is required. string
A filter to return only resources their lifecycleState matches the given lifecycleState.
systemTags This property is required. {[key: string]: string}
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
timeCreated This property is required. string
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
timeUpdated This property is required. string
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
backup_retention_period_in_days This property is required. int
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
compartment_id This property is required. str
The 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. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
display_name This property is required. str
A filter to return only resources that match the entire 'displayname' given.
freeform_tags This property is required. Mapping[str, str]
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. str
The protection policy OCID.
is_predefined_policy This property is required. bool
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
lifecycle_details This property is required. str
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
must_enforce_cloud_locality This property is required. bool
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
policy_locked_date_time This property is required. str
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
state This property is required. str
A filter to return only resources their lifecycleState matches the given lifecycleState.
system_tags This property is required. Mapping[str, str]
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
time_created This property is required. str
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
time_updated This property is required. str
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
backupRetentionPeriodInDays This property is required. Number
The maximum number of days to retain backups for a protected database. Specify a period ranging from a minimum 14 days to a maximum 95 days. For example, specify the value 55 if you want to retain backups for 55 days.
compartmentId This property is required. String
The compartment OCID.
definedTags This property is required. Map<String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}. For more information, see Resource Tags
displayName This property is required. String
A filter to return only resources that match the entire 'displayname' given.
freeformTags This property is required. Map<String>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. String
The protection policy OCID.
isPredefinedPolicy This property is required. Boolean
Set to TRUE if the policy is Oracle-defined, and FALSE for a user-defined custom policy. You can modify only the custom policies.
lifecycleDetails This property is required. String
Detailed description about the current lifecycle state of the protection policy. For example, it can be used to provide actionable information for a resource in a Failed state.
mustEnforceCloudLocality This property is required. Boolean
Indicates whether the protection policy enforces Recovery Service to retain backups in the same cloud service environment where your Oracle Database is provisioned.
policyLockedDateTime This property is required. String
An RFC3339 formatted datetime string that specifies the exact date and time for the retention lock to take effect and permanently lock the retention period defined in the policy.
state This property is required. String
A filter to return only resources their lifecycleState matches the given lifecycleState.
systemTags This property is required. Map<String>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}. For more information, see Resource Tags
timeCreated This property is required. String
An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
timeUpdated This property is required. String
An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21: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.
Oracle Cloud Infrastructure v2.28.0 published on Thursday, Mar 27, 2025 by Pulumi