1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. nas
  5. getLifecyclePolicies
Alibaba Cloud v3.69.0 published on Monday, Dec 9, 2024 by Pulumi

alicloud.nas.getLifecyclePolicies

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.69.0 published on Monday, Dec 9, 2024 by Pulumi

    This data source provides the Nas Lifecycle Policies of the current Alibaba Cloud user.

    NOTE: Available in v1.153.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.nas.getLifecyclePolicies({
        fileSystemId: "example_value",
        ids: [
            "my-LifecyclePolicy-1",
            "my-LifecyclePolicy-2",
        ],
    });
    export const nasLifecyclePolicyId1 = ids.then(ids => ids.policies?.[0]?.id);
    const nameRegex = alicloud.nas.getLifecyclePolicies({
        fileSystemId: "example_value",
        nameRegex: "^my-LifecyclePolicy",
    });
    export const nasLifecyclePolicyId2 = nameRegex.then(nameRegex => nameRegex.policies?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.nas.get_lifecycle_policies(file_system_id="example_value",
        ids=[
            "my-LifecyclePolicy-1",
            "my-LifecyclePolicy-2",
        ])
    pulumi.export("nasLifecyclePolicyId1", ids.policies[0].id)
    name_regex = alicloud.nas.get_lifecycle_policies(file_system_id="example_value",
        name_regex="^my-LifecyclePolicy")
    pulumi.export("nasLifecyclePolicyId2", name_regex.policies[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nas"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := nas.GetLifecyclePolicies(ctx, &nas.GetLifecyclePoliciesArgs{
    			FileSystemId: "example_value",
    			Ids: []string{
    				"my-LifecyclePolicy-1",
    				"my-LifecyclePolicy-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("nasLifecyclePolicyId1", ids.Policies[0].Id)
    		nameRegex, err := nas.GetLifecyclePolicies(ctx, &nas.GetLifecyclePoliciesArgs{
    			FileSystemId: "example_value",
    			NameRegex:    pulumi.StringRef("^my-LifecyclePolicy"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("nasLifecyclePolicyId2", nameRegex.Policies[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Nas.GetLifecyclePolicies.Invoke(new()
        {
            FileSystemId = "example_value",
            Ids = new[]
            {
                "my-LifecyclePolicy-1",
                "my-LifecyclePolicy-2",
            },
        });
    
        var nameRegex = AliCloud.Nas.GetLifecyclePolicies.Invoke(new()
        {
            FileSystemId = "example_value",
            NameRegex = "^my-LifecyclePolicy",
        });
    
        return new Dictionary<string, object?>
        {
            ["nasLifecyclePolicyId1"] = ids.Apply(getLifecyclePoliciesResult => getLifecyclePoliciesResult.Policies[0]?.Id),
            ["nasLifecyclePolicyId2"] = nameRegex.Apply(getLifecyclePoliciesResult => getLifecyclePoliciesResult.Policies[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.nas.NasFunctions;
    import com.pulumi.alicloud.nas.inputs.GetLifecyclePoliciesArgs;
    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 ids = NasFunctions.getLifecyclePolicies(GetLifecyclePoliciesArgs.builder()
                .fileSystemId("example_value")
                .ids(            
                    "my-LifecyclePolicy-1",
                    "my-LifecyclePolicy-2")
                .build());
    
            ctx.export("nasLifecyclePolicyId1", ids.applyValue(getLifecyclePoliciesResult -> getLifecyclePoliciesResult.policies()[0].id()));
            final var nameRegex = NasFunctions.getLifecyclePolicies(GetLifecyclePoliciesArgs.builder()
                .fileSystemId("example_value")
                .nameRegex("^my-LifecyclePolicy")
                .build());
    
            ctx.export("nasLifecyclePolicyId2", nameRegex.applyValue(getLifecyclePoliciesResult -> getLifecyclePoliciesResult.policies()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:nas:getLifecyclePolicies
          Arguments:
            fileSystemId: example_value
            ids:
              - my-LifecyclePolicy-1
              - my-LifecyclePolicy-2
      nameRegex:
        fn::invoke:
          Function: alicloud:nas:getLifecyclePolicies
          Arguments:
            fileSystemId: example_value
            nameRegex: ^my-LifecyclePolicy
    outputs:
      nasLifecyclePolicyId1: ${ids.policies[0].id}
      nasLifecyclePolicyId2: ${nameRegex.policies[0].id}
    

    Using getLifecyclePolicies

    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 getLifecyclePolicies(args: GetLifecyclePoliciesArgs, opts?: InvokeOptions): Promise<GetLifecyclePoliciesResult>
    function getLifecyclePoliciesOutput(args: GetLifecyclePoliciesOutputArgs, opts?: InvokeOptions): Output<GetLifecyclePoliciesResult>
    def get_lifecycle_policies(file_system_id: Optional[str] = None,
                               ids: Optional[Sequence[str]] = None,
                               name_regex: Optional[str] = None,
                               output_file: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetLifecyclePoliciesResult
    def get_lifecycle_policies_output(file_system_id: Optional[pulumi.Input[str]] = None,
                               ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                               name_regex: Optional[pulumi.Input[str]] = None,
                               output_file: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetLifecyclePoliciesResult]
    func GetLifecyclePolicies(ctx *Context, args *GetLifecyclePoliciesArgs, opts ...InvokeOption) (*GetLifecyclePoliciesResult, error)
    func GetLifecyclePoliciesOutput(ctx *Context, args *GetLifecyclePoliciesOutputArgs, opts ...InvokeOption) GetLifecyclePoliciesResultOutput

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

    public static class GetLifecyclePolicies 
    {
        public static Task<GetLifecyclePoliciesResult> InvokeAsync(GetLifecyclePoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetLifecyclePoliciesResult> Invoke(GetLifecyclePoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLifecyclePoliciesResult> getLifecyclePolicies(GetLifecyclePoliciesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:nas/getLifecyclePolicies:getLifecyclePolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    FileSystemId string
    The ID of the file system.
    Ids List<string>
    A list of Lifecycle Policy IDs.
    NameRegex string
    A regex string to filter results by Lifecycle Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    FileSystemId string
    The ID of the file system.
    Ids []string
    A list of Lifecycle Policy IDs.
    NameRegex string
    A regex string to filter results by Lifecycle Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    fileSystemId String
    The ID of the file system.
    ids List<String>
    A list of Lifecycle Policy IDs.
    nameRegex String
    A regex string to filter results by Lifecycle Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    fileSystemId string
    The ID of the file system.
    ids string[]
    A list of Lifecycle Policy IDs.
    nameRegex string
    A regex string to filter results by Lifecycle Policy name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    file_system_id str
    The ID of the file system.
    ids Sequence[str]
    A list of Lifecycle Policy IDs.
    name_regex str
    A regex string to filter results by Lifecycle Policy name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    fileSystemId String
    The ID of the file system.
    ids List<String>
    A list of Lifecycle Policy IDs.
    nameRegex String
    A regex string to filter results by Lifecycle Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getLifecyclePolicies Result

    The following output properties are available:

    FileSystemId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    Policies List<Pulumi.AliCloud.Nas.Outputs.GetLifecyclePoliciesPolicy>
    NameRegex string
    OutputFile string
    FileSystemId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Policies []GetLifecyclePoliciesPolicy
    NameRegex string
    OutputFile string
    fileSystemId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<GetLifecyclePoliciesPolicy>
    nameRegex String
    outputFile String
    fileSystemId string
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    policies GetLifecyclePoliciesPolicy[]
    nameRegex string
    outputFile string
    file_system_id str
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    policies Sequence[GetLifecyclePoliciesPolicy]
    name_regex str
    output_file str
    fileSystemId String
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<Property Map>
    nameRegex String
    outputFile String

    Supporting Types

    GetLifecyclePoliciesPolicy

    CreateTime string
    The time when the lifecycle management policy was created.
    FileSystemId string
    The ID of the file system.
    Id string
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    LifecyclePolicyName string
    The name of the lifecycle management policy.
    LifecycleRuleName string
    The rules in the lifecycle management policy.
    Paths List<string>
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    StorageType string
    The storage type of the data that is dumped to the IA storage medium.
    CreateTime string
    The time when the lifecycle management policy was created.
    FileSystemId string
    The ID of the file system.
    Id string
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    LifecyclePolicyName string
    The name of the lifecycle management policy.
    LifecycleRuleName string
    The rules in the lifecycle management policy.
    Paths []string
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    StorageType string
    The storage type of the data that is dumped to the IA storage medium.
    createTime String
    The time when the lifecycle management policy was created.
    fileSystemId String
    The ID of the file system.
    id String
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    lifecyclePolicyName String
    The name of the lifecycle management policy.
    lifecycleRuleName String
    The rules in the lifecycle management policy.
    paths List<String>
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    storageType String
    The storage type of the data that is dumped to the IA storage medium.
    createTime string
    The time when the lifecycle management policy was created.
    fileSystemId string
    The ID of the file system.
    id string
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    lifecyclePolicyName string
    The name of the lifecycle management policy.
    lifecycleRuleName string
    The rules in the lifecycle management policy.
    paths string[]
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    storageType string
    The storage type of the data that is dumped to the IA storage medium.
    create_time str
    The time when the lifecycle management policy was created.
    file_system_id str
    The ID of the file system.
    id str
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    lifecycle_policy_name str
    The name of the lifecycle management policy.
    lifecycle_rule_name str
    The rules in the lifecycle management policy.
    paths Sequence[str]
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    storage_type str
    The storage type of the data that is dumped to the IA storage medium.
    createTime String
    The time when the lifecycle management policy was created.
    fileSystemId String
    The ID of the file system.
    id String
    The ID of the Lifecycle Policy. Its value is same as Queue Name.
    lifecyclePolicyName String
    The name of the lifecycle management policy.
    lifecycleRuleName String
    The rules in the lifecycle management policy.
    paths List<String>
    The list of absolute paths for multiple directories. In this case, you can associate a lifecycle management policy with each directory.
    storageType String
    The storage type of the data that is dumped to the IA storage medium.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.69.0 published on Monday, Dec 9, 2024 by Pulumi