1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. RecoveryMod
  5. getProtectionPolicies
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi

oci.RecoveryMod.getProtectionPolicies

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 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: _var.compartment_id,
        displayName: _var.protection_policy_display_name,
        owner: _var.protection_policy_owner,
        protectionPolicyId: oci_recovery_protection_policy.test_protection_policy.id,
        state: _var.protection_policy_state,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_protection_policies = oci.RecoveryMod.get_protection_policies(compartment_id=var["compartment_id"],
        display_name=var["protection_policy_display_name"],
        owner=var["protection_policy_owner"],
        protection_policy_id=oci_recovery_protection_policy["test_protection_policy"]["id"],
        state=var["protection_policy_state"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/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:      _var.Compartment_id,
    			DisplayName:        pulumi.StringRef(_var.Protection_policy_display_name),
    			Owner:              pulumi.StringRef(_var.Protection_policy_owner),
    			ProtectionPolicyId: pulumi.StringRef(oci_recovery_protection_policy.Test_protection_policy.Id),
    			State:              pulumi.StringRef(_var.Protection_policy_state),
    		}, 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 testProtectionPolicies = Oci.RecoveryMod.GetProtectionPolicies.Invoke(new()
        {
            CompartmentId = @var.Compartment_id,
            DisplayName = @var.Protection_policy_display_name,
            Owner = @var.Protection_policy_owner,
            ProtectionPolicyId = oci_recovery_protection_policy.Test_protection_policy.Id,
            State = @var.Protection_policy_state,
        });
    
    });
    
    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(var_.compartment_id())
                .displayName(var_.protection_policy_display_name())
                .owner(var_.protection_policy_owner())
                .protectionPolicyId(oci_recovery_protection_policy.test_protection_policy().id())
                .state(var_.protection_policy_state())
                .build());
    
        }
    }
    
    variables:
      testProtectionPolicies:
        fn::invoke:
          Function: oci:RecoveryMod:getProtectionPolicies
          Arguments:
            compartmentId: ${var.compartment_id}
            displayName: ${var.protection_policy_display_name}
            owner: ${var.protection_policy_owner}
            protectionPolicyId: ${oci_recovery_protection_policy.test_protection_policy.id}
            state: ${var.protection_policy_state}
    

    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>
    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]
    func GetProtectionPolicies(ctx *Context, args *GetProtectionPoliciesArgs, opts ...InvokeOption) (*GetProtectionPoliciesResult, error)
    func GetProtectionPoliciesOutput(ctx *Context, args *GetProtectionPoliciesOutputArgs, opts ...InvokeOption) GetProtectionPoliciesResultOutput

    > 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)
    }
    public static CompletableFuture<GetProtectionPoliciesResult> getProtectionPolicies(GetProtectionPoliciesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: oci:RecoveryMod/getProtectionPolicies:getProtectionPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    CompartmentId string
    The compartment OCID.
    DisplayName string
    A filter to return only resources that match the entire 'displayname' given.
    Filters 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 string
    The compartment OCID.
    DisplayName string
    A filter to return only resources that match the entire 'displayname' given.
    Filters []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 String
    The compartment OCID.
    displayName String
    A filter to return only resources that match the entire 'displayname' given.
    filters 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 string
    The compartment OCID.
    displayName string
    A filter to return only resources that match the entire 'displayname' given.
    filters 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 str
    The compartment OCID.
    display_name str
    A filter to return only resources that match the entire 'displayname' given.
    filters 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 String
    The compartment OCID.
    displayName String
    A filter to return only resources that match the entire 'displayname' given.
    filters 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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED
    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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED
    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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED
    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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED
    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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED
    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. Allowed values are:

    • CREATING
    • UPDATING
    • ACTIVE
    • DELETING
    • DELETED
    • FAILED

    Supporting Types

    GetProtectionPoliciesFilter

    Name string
    Values List<string>
    Regex bool
    Name string
    Values []string
    Regex bool
    name String
    values List<String>
    regex Boolean
    name string
    values string[]
    regex boolean
    name str
    values Sequence[str]
    regex bool
    name String
    values List<String>
    regex Boolean

    GetProtectionPoliciesProtectionPolicyCollection

    GetProtectionPoliciesProtectionPolicyCollectionItem

    BackupRetentionPeriodInDays 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 string
    The compartment OCID.
    DefinedTags Dictionary<string, object>
    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 string
    A filter to return only resources that match the entire 'displayname' given.
    FreeformTags Dictionary<string, object>
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    Id string
    The protection policy OCID.
    IsPredefinedPolicy 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 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.
    State string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    SystemTags Dictionary<string, object>
    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 string
    An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    TimeUpdated string
    An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    BackupRetentionPeriodInDays 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 string
    The compartment OCID.
    DefinedTags map[string]interface{}
    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 string
    A filter to return only resources that match the entire 'displayname' given.
    FreeformTags map[string]interface{}
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    Id string
    The protection policy OCID.
    IsPredefinedPolicy 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 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.
    State string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    SystemTags map[string]interface{}
    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 string
    An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    TimeUpdated string
    An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    backupRetentionPeriodInDays 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 String
    The compartment OCID.
    definedTags Map<String,Object>
    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 String
    A filter to return only resources that match the entire 'displayname' given.
    freeformTags Map<String,Object>
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    id String
    The protection policy OCID.
    isPredefinedPolicy 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 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.
    state String
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    systemTags Map<String,Object>
    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 String
    An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    timeUpdated String
    An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    backupRetentionPeriodInDays 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 string
    The compartment OCID.
    definedTags {[key: string]: any}
    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 string
    A filter to return only resources that match the entire 'displayname' given.
    freeformTags {[key: string]: any}
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    id string
    The protection policy OCID.
    isPredefinedPolicy 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 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.
    state string
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    systemTags {[key: string]: any}
    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 string
    An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    timeUpdated 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 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 str
    The compartment OCID.
    defined_tags Mapping[str, Any]
    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 str
    A filter to return only resources that match the entire 'displayname' given.
    freeform_tags Mapping[str, Any]
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    id str
    The protection policy OCID.
    is_predefined_policy 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 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.
    state str
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    system_tags Mapping[str, Any]
    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 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 str
    An RFC3339 formatted datetime string that indicates the updated time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    backupRetentionPeriodInDays 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 String
    The compartment OCID.
    definedTags Map<Any>
    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 String
    A filter to return only resources that match the entire 'displayname' given.
    freeformTags Map<Any>
    Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
    id String
    The protection policy OCID.
    isPredefinedPolicy 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 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.
    state String
    A filter to return only resources their lifecycleState matches the given lifecycleState.
    systemTags Map<Any>
    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 String
    An RFC3339 formatted datetime string that indicates the created time for the protection policy. For example: '2020-05-22T21:10:29.600Z'.
    timeUpdated 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.
    oci logo
    Oracle Cloud Infrastructure v1.32.0 published on Thursday, Apr 18, 2024 by Pulumi