alicloud logo
Alibaba Cloud v3.38.0, Jun 2 23

alicloud.dfs.AccessRule

Explore with Pulumi AI

Provides a DFS Access Rule resource.

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

NOTE: Available in v1.140.0+.

Example Usage

Basic Usage

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") ?? "example_name";
    var defaultAccessGroup = new AliCloud.Dfs.AccessGroup("defaultAccessGroup", new()
    {
        NetworkType = "VPC",
        AccessGroupName = name,
        Description = name,
    });

    var defaultAccessRule = new AliCloud.Dfs.AccessRule("defaultAccessRule", new()
    {
        NetworkSegment = "192.0.2.0/24",
        AccessGroupId = defaultAccessGroup.Id,
        Description = name,
        RwAccessType = "RDWR",
        Priority = 10,
    });

});
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 := "example_name"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultAccessGroup, err := dfs.NewAccessGroup(ctx, "defaultAccessGroup", &dfs.AccessGroupArgs{
			NetworkType:     pulumi.String("VPC"),
			AccessGroupName: pulumi.String(name),
			Description:     pulumi.String(name),
		})
		if err != nil {
			return err
		}
		_, err = dfs.NewAccessRule(ctx, "defaultAccessRule", &dfs.AccessRuleArgs{
			NetworkSegment: pulumi.String("192.0.2.0/24"),
			AccessGroupId:  defaultAccessGroup.ID(),
			Description:    pulumi.String(name),
			RwAccessType:   pulumi.String("RDWR"),
			Priority:       pulumi.Int(10),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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("example_name");
        var defaultAccessGroup = new AccessGroup("defaultAccessGroup", AccessGroupArgs.builder()        
            .networkType("VPC")
            .accessGroupName(name)
            .description(name)
            .build());

        var defaultAccessRule = new AccessRule("defaultAccessRule", AccessRuleArgs.builder()        
            .networkSegment("192.0.2.0/24")
            .accessGroupId(defaultAccessGroup.id())
            .description(name)
            .rwAccessType("RDWR")
            .priority("10")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "example_name"
default_access_group = alicloud.dfs.AccessGroup("defaultAccessGroup",
    network_type="VPC",
    access_group_name=name,
    description=name)
default_access_rule = alicloud.dfs.AccessRule("defaultAccessRule",
    network_segment="192.0.2.0/24",
    access_group_id=default_access_group.id,
    description=name,
    rw_access_type="RDWR",
    priority=10)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "example_name";
const defaultAccessGroup = new alicloud.dfs.AccessGroup("defaultAccessGroup", {
    networkType: "VPC",
    accessGroupName: name,
    description: name,
});
const defaultAccessRule = new alicloud.dfs.AccessRule("defaultAccessRule", {
    networkSegment: "192.0.2.0/24",
    accessGroupId: defaultAccessGroup.id,
    description: name,
    rwAccessType: "RDWR",
    priority: 10,
});
configuration:
  name:
    type: string
    default: example_name
resources:
  defaultAccessGroup:
    type: alicloud:dfs:AccessGroup
    properties:
      networkType: VPC
      accessGroupName: ${name}
      description: ${name}
  defaultAccessRule:
    type: alicloud:dfs:AccessRule
    properties:
      networkSegment: 192.0.2.0/24
      accessGroupId: ${defaultAccessGroup.id}
      description: ${name}
      rwAccessType: RDWR
      priority: '10'

Create AccessRule Resource

new AccessRule(name: string, args: AccessRuleArgs, opts?: CustomResourceOptions);
@overload
def AccessRule(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               access_group_id: Optional[str] = None,
               description: Optional[str] = None,
               network_segment: Optional[str] = None,
               priority: Optional[int] = None,
               rw_access_type: Optional[str] = None)
@overload
def AccessRule(resource_name: str,
               args: AccessRuleArgs,
               opts: Optional[ResourceOptions] = 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.

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.

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

The resource ID of Access Group.

NetworkSegment string

The NetworkSegment of the Access Rule.

Priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

RwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

Description string

The Description of the Access Rule.

AccessGroupId string

The resource ID of Access Group.

NetworkSegment string

The NetworkSegment of the Access Rule.

Priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

RwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

Description string

The Description of the Access Rule.

accessGroupId String

The resource ID of Access Group.

networkSegment String

The NetworkSegment of the Access Rule.

priority Integer

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType String

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

description String

The Description of the Access Rule.

accessGroupId string

The resource ID of Access Group.

networkSegment string

The NetworkSegment of the Access Rule.

priority number

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

description string

The Description of the Access Rule.

access_group_id str

The resource ID of Access Group.

network_segment str

The NetworkSegment of the Access Rule.

priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rw_access_type str

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

description str

The Description of the Access Rule.

accessGroupId String

The resource ID of Access Group.

networkSegment String

The NetworkSegment of the Access Rule.

priority Number

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType String

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

description String

The Description of the Access Rule.

Outputs

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

AccessRuleId string

The ID of the Access Rule.

Id string

The provider-assigned unique ID for this managed resource.

AccessRuleId string

The ID of the Access Rule.

Id string

The provider-assigned unique ID for this managed resource.

accessRuleId String

The ID of the Access Rule.

id String

The provider-assigned unique ID for this managed resource.

accessRuleId string

The ID of the Access Rule.

id string

The provider-assigned unique ID for this managed resource.

access_rule_id str

The ID of the Access Rule.

id str

The provider-assigned unique ID for this managed resource.

accessRuleId String

The ID of the Access Rule.

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,
        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

The resource ID of Access Group.

AccessRuleId string

The ID of the Access Rule.

Description string

The Description of the Access Rule.

NetworkSegment string

The NetworkSegment of the Access Rule.

Priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

RwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

AccessGroupId string

The resource ID of Access Group.

AccessRuleId string

The ID of the Access Rule.

Description string

The Description of the Access Rule.

NetworkSegment string

The NetworkSegment of the Access Rule.

Priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

RwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

accessGroupId String

The resource ID of Access Group.

accessRuleId String

The ID of the Access Rule.

description String

The Description of the Access Rule.

networkSegment String

The NetworkSegment of the Access Rule.

priority Integer

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType String

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

accessGroupId string

The resource ID of Access Group.

accessRuleId string

The ID of the Access Rule.

description string

The Description of the Access Rule.

networkSegment string

The NetworkSegment of the Access Rule.

priority number

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType string

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

access_group_id str

The resource ID of Access Group.

access_rule_id str

The ID of the Access Rule.

description str

The Description of the Access Rule.

network_segment str

The NetworkSegment of the Access Rule.

priority int

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rw_access_type str

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

accessGroupId String

The resource ID of Access Group.

accessRuleId String

The ID of the Access Rule.

description String

The Description of the Access Rule.

networkSegment String

The NetworkSegment of the Access Rule.

priority Number

The Priority of the Access Rule. Valid values: 1 to 100. NOTE: When multiple rules are matched by the same authorized object, the high-priority rule takes effect. 1 is the highest priority.

rwAccessType String

The RWAccessType of the Access Rule. Valid values: RDONLY, RDWR.

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>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.