1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. dfs
  5. AccessRule
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.dfs.AccessRule

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a DFS Access Rule resource.

    For information about DFS Access Rule and how to use it, see What is Access Rule.

    NOTE: Available since v1.140.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const defaultAccessGroup = new alicloud.dfs.AccessGroup("defaultAccessGroup", {
        description: "example",
        networkType: "VPC",
        accessGroupName: name,
    });
    const defaultAccessRule = new alicloud.dfs.AccessRule("defaultAccessRule", {
        description: "example",
        rwAccessType: "RDWR",
        priority: 1,
        networkSegment: "192.168.81.1",
        accessGroupId: defaultAccessGroup.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default_access_group = alicloud.dfs.AccessGroup("defaultAccessGroup",
        description="example",
        network_type="VPC",
        access_group_name=name)
    default_access_rule = alicloud.dfs.AccessRule("defaultAccessRule",
        description="example",
        rw_access_type="RDWR",
        priority=1,
        network_segment="192.168.81.1",
        access_group_id=default_access_group.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dfs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultAccessGroup, err := dfs.NewAccessGroup(ctx, "defaultAccessGroup", &dfs.AccessGroupArgs{
    			Description:     pulumi.String("example"),
    			NetworkType:     pulumi.String("VPC"),
    			AccessGroupName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dfs.NewAccessRule(ctx, "defaultAccessRule", &dfs.AccessRuleArgs{
    			Description:    pulumi.String("example"),
    			RwAccessType:   pulumi.String("RDWR"),
    			Priority:       pulumi.Int(1),
    			NetworkSegment: pulumi.String("192.168.81.1"),
    			AccessGroupId:  defaultAccessGroup.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var defaultAccessGroup = new AliCloud.Dfs.AccessGroup("defaultAccessGroup", new()
        {
            Description = "example",
            NetworkType = "VPC",
            AccessGroupName = name,
        });
    
        var defaultAccessRule = new AliCloud.Dfs.AccessRule("defaultAccessRule", new()
        {
            Description = "example",
            RwAccessType = "RDWR",
            Priority = 1,
            NetworkSegment = "192.168.81.1",
            AccessGroupId = defaultAccessGroup.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.dfs.AccessGroup;
    import com.pulumi.alicloud.dfs.AccessGroupArgs;
    import com.pulumi.alicloud.dfs.AccessRule;
    import com.pulumi.alicloud.dfs.AccessRuleArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var defaultAccessGroup = new AccessGroup("defaultAccessGroup", AccessGroupArgs.builder()        
                .description("example")
                .networkType("VPC")
                .accessGroupName(name)
                .build());
    
            var defaultAccessRule = new AccessRule("defaultAccessRule", AccessRuleArgs.builder()        
                .description("example")
                .rwAccessType("RDWR")
                .priority("1")
                .networkSegment("192.168.81.1")
                .accessGroupId(defaultAccessGroup.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultAccessGroup:
        type: alicloud:dfs:AccessGroup
        properties:
          description: example
          networkType: VPC
          accessGroupName: ${name}
      defaultAccessRule:
        type: alicloud:dfs:AccessRule
        properties:
          description: example
          rwAccessType: RDWR
          priority: '1'
          networkSegment: 192.168.81.1
          accessGroupId: ${defaultAccessGroup.id}
    

    Create AccessRule Resource

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

    Constructor syntax

    new AccessRule(name: string, args: AccessRuleArgs, opts?: CustomResourceOptions);
    @overload
    def AccessRule(resource_name: str,
                   args: AccessRuleArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccessRule(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   access_group_id: Optional[str] = None,
                   network_segment: Optional[str] = None,
                   priority: Optional[int] = None,
                   rw_access_type: Optional[str] = None,
                   description: Optional[str] = None)
    func NewAccessRule(ctx *Context, name string, args AccessRuleArgs, opts ...ResourceOption) (*AccessRule, error)
    public AccessRule(string name, AccessRuleArgs args, CustomResourceOptions? opts = null)
    public AccessRule(String name, AccessRuleArgs args)
    public AccessRule(String name, AccessRuleArgs args, CustomResourceOptions options)
    
    type: alicloud:dfs:AccessRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

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

    Example

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

    var accessRuleResource = new AliCloud.Dfs.AccessRule("accessRuleResource", new()
    {
        AccessGroupId = "string",
        NetworkSegment = "string",
        Priority = 0,
        RwAccessType = "string",
        Description = "string",
    });
    
    example, err := dfs.NewAccessRule(ctx, "accessRuleResource", &dfs.AccessRuleArgs{
    	AccessGroupId:  pulumi.String("string"),
    	NetworkSegment: pulumi.String("string"),
    	Priority:       pulumi.Int(0),
    	RwAccessType:   pulumi.String("string"),
    	Description:    pulumi.String("string"),
    })
    
    var accessRuleResource = new AccessRule("accessRuleResource", AccessRuleArgs.builder()        
        .accessGroupId("string")
        .networkSegment("string")
        .priority(0)
        .rwAccessType("string")
        .description("string")
        .build());
    
    access_rule_resource = alicloud.dfs.AccessRule("accessRuleResource",
        access_group_id="string",
        network_segment="string",
        priority=0,
        rw_access_type="string",
        description="string")
    
    const accessRuleResource = new alicloud.dfs.AccessRule("accessRuleResource", {
        accessGroupId: "string",
        networkSegment: "string",
        priority: 0,
        rwAccessType: "string",
        description: "string",
    });
    
    type: alicloud:dfs:AccessRule
    properties:
        accessGroupId: string
        description: string
        networkSegment: string
        priority: 0
        rwAccessType: string
    

    AccessRule Resource Properties

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

    Inputs

    The AccessRule resource accepts the following input properties:

    AccessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    NetworkSegment string
    The IP address or network segment of the authorized object.
    Priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    RwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    Description string
    Permission rule description. No more than 32 characters in length.
    AccessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    NetworkSegment string
    The IP address or network segment of the authorized object.
    Priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    RwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    Description string
    Permission rule description. No more than 32 characters in length.
    accessGroupId String
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    networkSegment String
    The IP address or network segment of the authorized object.
    priority Integer
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType String
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    description String
    Permission rule description. No more than 32 characters in length.
    accessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    networkSegment string
    The IP address or network segment of the authorized object.
    priority number
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    description string
    Permission rule description. No more than 32 characters in length.
    access_group_id str
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    network_segment str
    The IP address or network segment of the authorized object.
    priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rw_access_type str
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    description str
    Permission rule description. No more than 32 characters in length.
    accessGroupId String
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    networkSegment String
    The IP address or network segment of the authorized object.
    priority Number
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType String
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    description String
    Permission rule description. No more than 32 characters in length.

    Outputs

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

    AccessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    CreateTime string
    Permission rule resource creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    AccessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    CreateTime string
    Permission rule resource creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    accessRuleId String
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime String
    Permission rule resource creation time.
    id String
    The provider-assigned unique ID for this managed resource.
    accessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime string
    Permission rule resource creation time.
    id string
    The provider-assigned unique ID for this managed resource.
    access_rule_id str
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    create_time str
    Permission rule resource creation time.
    id str
    The provider-assigned unique ID for this managed resource.
    accessRuleId String
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime String
    Permission rule resource creation time.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AccessRule Resource

    Get an existing AccessRule 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?: AccessRuleState, opts?: CustomResourceOptions): AccessRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_group_id: Optional[str] = None,
            access_rule_id: Optional[str] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            network_segment: Optional[str] = None,
            priority: Optional[int] = None,
            rw_access_type: Optional[str] = None) -> AccessRule
    func GetAccessRule(ctx *Context, name string, id IDInput, state *AccessRuleState, opts ...ResourceOption) (*AccessRule, error)
    public static AccessRule Get(string name, Input<string> id, AccessRuleState? state, CustomResourceOptions? opts = null)
    public static AccessRule get(String name, Output<String> id, AccessRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    AccessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    AccessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    CreateTime string
    Permission rule resource creation time.
    Description string
    Permission rule description. No more than 32 characters in length.
    NetworkSegment string
    The IP address or network segment of the authorized object.
    Priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    RwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    AccessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    AccessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    CreateTime string
    Permission rule resource creation time.
    Description string
    Permission rule description. No more than 32 characters in length.
    NetworkSegment string
    The IP address or network segment of the authorized object.
    Priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    RwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    accessGroupId String
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    accessRuleId String
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime String
    Permission rule resource creation time.
    description String
    Permission rule description. No more than 32 characters in length.
    networkSegment String
    The IP address or network segment of the authorized object.
    priority Integer
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType String
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    accessGroupId string
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    accessRuleId string
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime string
    Permission rule resource creation time.
    description string
    Permission rule description. No more than 32 characters in length.
    networkSegment string
    The IP address or network segment of the authorized object.
    priority number
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType string
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    access_group_id str
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    access_rule_id str
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    create_time str
    Permission rule resource creation time.
    description str
    Permission rule description. No more than 32 characters in length.
    network_segment str
    The IP address or network segment of the authorized object.
    priority int
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rw_access_type str
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.
    accessGroupId String
    Permission group resource ID. You must specify the permission group ID when creating a permission rule.
    accessRuleId String
    The unique identity of the permission rule, which is used to retrieve the permission rule for a specific day in the permission group.
    createTime String
    Permission rule resource creation time.
    description String
    Permission rule description. No more than 32 characters in length.
    networkSegment String
    The IP address or network segment of the authorized object.
    priority Number
    Permission rule priority. When the same authorization object matches multiple rules, the high-priority rule takes effect. Value range: 1~100,1 is the highest priority.
    rwAccessType String
    The read and write permissions of the authorized object on the file system. Value: RDWR: readable and writable RDONLY: Read only.

    Import

    DFS Access Rule can be imported using the id, e.g.

    $ pulumi import alicloud:dfs/accessRule:AccessRule example <access_group_id>:<access_rule_id>
    

    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.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi