1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. nas
  5. LifecyclePolicy
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.nas.LifecyclePolicy

Explore with Pulumi AI

Provides a File Storage (NAS) Lifecycle Policy resource.

For information about File Storage (NAS) Lifecycle Policy and how to use it, see What is Lifecycle Policy.

NOTE: Available in v1.153.0+.

Example Usage

Basic Usage

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

const example = new alicloud.nas.FileSystem("example", {
    protocolType: "NFS",
    storageType: "Capacity",
});
const exampleLifecyclePolicy = new alicloud.nas.LifecyclePolicy("example", {
    fileSystemId: example.id,
    lifecyclePolicyName: "terraform-example",
    lifecycleRuleName: "DEFAULT_ATIME_14",
    storageType: "InfrequentAccess",
    paths: ["/"],
});
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.nas.FileSystem("example",
    protocol_type="NFS",
    storage_type="Capacity")
example_lifecycle_policy = alicloud.nas.LifecyclePolicy("example",
    file_system_id=example.id,
    lifecycle_policy_name="terraform-example",
    lifecycle_rule_name="DEFAULT_ATIME_14",
    storage_type="InfrequentAccess",
    paths=["/"])
Copy
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 {
		example, err := nas.NewFileSystem(ctx, "example", &nas.FileSystemArgs{
			ProtocolType: pulumi.String("NFS"),
			StorageType:  pulumi.String("Capacity"),
		})
		if err != nil {
			return err
		}
		_, err = nas.NewLifecyclePolicy(ctx, "example", &nas.LifecyclePolicyArgs{
			FileSystemId:        example.ID(),
			LifecyclePolicyName: pulumi.String("terraform-example"),
			LifecycleRuleName:   pulumi.String("DEFAULT_ATIME_14"),
			StorageType:         pulumi.String("InfrequentAccess"),
			Paths: pulumi.StringArray{
				pulumi.String("/"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var example = new AliCloud.Nas.FileSystem("example", new()
    {
        ProtocolType = "NFS",
        StorageType = "Capacity",
    });

    var exampleLifecyclePolicy = new AliCloud.Nas.LifecyclePolicy("example", new()
    {
        FileSystemId = example.Id,
        LifecyclePolicyName = "terraform-example",
        LifecycleRuleName = "DEFAULT_ATIME_14",
        StorageType = "InfrequentAccess",
        Paths = new[]
        {
            "/",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.nas.FileSystem;
import com.pulumi.alicloud.nas.FileSystemArgs;
import com.pulumi.alicloud.nas.LifecyclePolicy;
import com.pulumi.alicloud.nas.LifecyclePolicyArgs;
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) {
        var example = new FileSystem("example", FileSystemArgs.builder()
            .protocolType("NFS")
            .storageType("Capacity")
            .build());

        var exampleLifecyclePolicy = new LifecyclePolicy("exampleLifecyclePolicy", LifecyclePolicyArgs.builder()
            .fileSystemId(example.id())
            .lifecyclePolicyName("terraform-example")
            .lifecycleRuleName("DEFAULT_ATIME_14")
            .storageType("InfrequentAccess")
            .paths("/")
            .build());

    }
}
Copy
resources:
  example:
    type: alicloud:nas:FileSystem
    properties:
      protocolType: NFS
      storageType: Capacity
  exampleLifecyclePolicy:
    type: alicloud:nas:LifecyclePolicy
    name: example
    properties:
      fileSystemId: ${example.id}
      lifecyclePolicyName: terraform-example
      lifecycleRuleName: DEFAULT_ATIME_14
      storageType: InfrequentAccess
      paths:
        - /
Copy

Create LifecyclePolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new LifecyclePolicy(name: string, args: LifecyclePolicyArgs, opts?: CustomResourceOptions);
@overload
def LifecyclePolicy(resource_name: str,
                    args: LifecyclePolicyArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def LifecyclePolicy(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    file_system_id: Optional[str] = None,
                    lifecycle_policy_name: Optional[str] = None,
                    lifecycle_rule_name: Optional[str] = None,
                    paths: Optional[Sequence[str]] = None,
                    storage_type: Optional[str] = None)
func NewLifecyclePolicy(ctx *Context, name string, args LifecyclePolicyArgs, opts ...ResourceOption) (*LifecyclePolicy, error)
public LifecyclePolicy(string name, LifecyclePolicyArgs args, CustomResourceOptions? opts = null)
public LifecyclePolicy(String name, LifecyclePolicyArgs args)
public LifecyclePolicy(String name, LifecyclePolicyArgs args, CustomResourceOptions options)
type: alicloud:nas:LifecyclePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var lifecyclePolicyResource = new AliCloud.Nas.LifecyclePolicy("lifecyclePolicyResource", new()
{
    FileSystemId = "string",
    LifecyclePolicyName = "string",
    LifecycleRuleName = "string",
    Paths = new[]
    {
        "string",
    },
    StorageType = "string",
});
Copy
example, err := nas.NewLifecyclePolicy(ctx, "lifecyclePolicyResource", &nas.LifecyclePolicyArgs{
	FileSystemId:        pulumi.String("string"),
	LifecyclePolicyName: pulumi.String("string"),
	LifecycleRuleName:   pulumi.String("string"),
	Paths: pulumi.StringArray{
		pulumi.String("string"),
	},
	StorageType: pulumi.String("string"),
})
Copy
var lifecyclePolicyResource = new LifecyclePolicy("lifecyclePolicyResource", LifecyclePolicyArgs.builder()
    .fileSystemId("string")
    .lifecyclePolicyName("string")
    .lifecycleRuleName("string")
    .paths("string")
    .storageType("string")
    .build());
Copy
lifecycle_policy_resource = alicloud.nas.LifecyclePolicy("lifecyclePolicyResource",
    file_system_id="string",
    lifecycle_policy_name="string",
    lifecycle_rule_name="string",
    paths=["string"],
    storage_type="string")
Copy
const lifecyclePolicyResource = new alicloud.nas.LifecyclePolicy("lifecyclePolicyResource", {
    fileSystemId: "string",
    lifecyclePolicyName: "string",
    lifecycleRuleName: "string",
    paths: ["string"],
    storageType: "string",
});
Copy
type: alicloud:nas:LifecyclePolicy
properties:
    fileSystemId: string
    lifecyclePolicyName: string
    lifecycleRuleName: string
    paths:
        - string
    storageType: string
Copy

LifecyclePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The LifecyclePolicy resource accepts the following input properties:

FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
LifecyclePolicyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lifecycle management policy.
LifecycleRuleName This property is required. string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
Paths
This property is required.
Changes to this property will trigger replacement.
List<string>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
StorageType
This property is required.
Changes to this property will trigger replacement.
string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
LifecyclePolicyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lifecycle management policy.
LifecycleRuleName This property is required. string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
Paths
This property is required.
Changes to this property will trigger replacement.
[]string
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
StorageType
This property is required.
Changes to this property will trigger replacement.
string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the file system.
lifecyclePolicyName
This property is required.
Changes to this property will trigger replacement.
String
The name of the lifecycle management policy.
lifecycleRuleName This property is required. String
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths
This property is required.
Changes to this property will trigger replacement.
List<String>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType
This property is required.
Changes to this property will trigger replacement.
String
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
lifecyclePolicyName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lifecycle management policy.
lifecycleRuleName This property is required. string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths
This property is required.
Changes to this property will trigger replacement.
string[]
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType
This property is required.
Changes to this property will trigger replacement.
string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
file_system_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the file system.
lifecycle_policy_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the lifecycle management policy.
lifecycle_rule_name This property is required. str
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths
This property is required.
Changes to this property will trigger replacement.
Sequence[str]
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storage_type
This property is required.
Changes to this property will trigger replacement.
str
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the file system.
lifecyclePolicyName
This property is required.
Changes to this property will trigger replacement.
String
The name of the lifecycle management policy.
lifecycleRuleName This property is required. String
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths
This property is required.
Changes to this property will trigger replacement.
List<String>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType
This property is required.
Changes to this property will trigger replacement.
String
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.

Outputs

All input properties are implicitly available as output properties. Additionally, the LifecyclePolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing LifecyclePolicy Resource

Get an existing LifecyclePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LifecyclePolicyState, opts?: CustomResourceOptions): LifecyclePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        file_system_id: Optional[str] = None,
        lifecycle_policy_name: Optional[str] = None,
        lifecycle_rule_name: Optional[str] = None,
        paths: Optional[Sequence[str]] = None,
        storage_type: Optional[str] = None) -> LifecyclePolicy
func GetLifecyclePolicy(ctx *Context, name string, id IDInput, state *LifecyclePolicyState, opts ...ResourceOption) (*LifecyclePolicy, error)
public static LifecyclePolicy Get(string name, Input<string> id, LifecyclePolicyState? state, CustomResourceOptions? opts = null)
public static LifecyclePolicy get(String name, Output<String> id, LifecyclePolicyState state, CustomResourceOptions options)
resources:  _:    type: alicloud:nas:LifecyclePolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
FileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
LifecyclePolicyName Changes to this property will trigger replacement. string
The name of the lifecycle management policy.
LifecycleRuleName string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
Paths Changes to this property will trigger replacement. List<string>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
StorageType Changes to this property will trigger replacement. string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
FileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
LifecyclePolicyName Changes to this property will trigger replacement. string
The name of the lifecycle management policy.
LifecycleRuleName string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
Paths Changes to this property will trigger replacement. []string
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
StorageType Changes to this property will trigger replacement. string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId Changes to this property will trigger replacement. String
The ID of the file system.
lifecyclePolicyName Changes to this property will trigger replacement. String
The name of the lifecycle management policy.
lifecycleRuleName String
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths Changes to this property will trigger replacement. List<String>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType Changes to this property will trigger replacement. String
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
lifecyclePolicyName Changes to this property will trigger replacement. string
The name of the lifecycle management policy.
lifecycleRuleName string
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths Changes to this property will trigger replacement. string[]
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType Changes to this property will trigger replacement. string
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
file_system_id Changes to this property will trigger replacement. str
The ID of the file system.
lifecycle_policy_name Changes to this property will trigger replacement. str
The name of the lifecycle management policy.
lifecycle_rule_name str
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths Changes to this property will trigger replacement. Sequence[str]
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storage_type Changes to this property will trigger replacement. str
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.
fileSystemId Changes to this property will trigger replacement. String
The ID of the file system.
lifecyclePolicyName Changes to this property will trigger replacement. String
The name of the lifecycle management policy.
lifecycleRuleName String
The rules in the lifecycle management policy. Valid values: DEFAULT_ATIME_14, DEFAULT_ATIME_30, DEFAULT_ATIME_60, DEFAULT_ATIME_90.
paths Changes to this property will trigger replacement. List<String>
The absolute path of the directory for which the lifecycle management policy is configured. Set a maximum of 10 path. The path value must be prefixed by a forward slash (/) and must be an existing path in the mount target.
storageType Changes to this property will trigger replacement. String
The storage type of the data that is dumped to the IA storage medium. Valid values: InfrequentAccess.

Import

File Storage (NAS) Lifecycle Policy can be imported using the id, e.g.

$ pulumi import alicloud:nas/lifecyclePolicy:LifecyclePolicy example <file_system_id>:<lifecycle_policy_name>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.