alicloud.nas.AccessRule
Explore with Pulumi AI
Provides a NAS Access Rule resource.
For information about NAS Access Rule and how to use it, see What is Access Rule.
NOTE: Available since v1.34.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultAccessGroup = new alicloud.nas.AccessGroup("default", {
accessGroupType: "Vpc",
description: "ExtremeAccessGroup",
accessGroupName: `terraform-example-${_default.result}`,
fileSystemType: "extreme",
});
const defaultAccessRule = new alicloud.nas.AccessRule("default", {
accessGroupName: defaultAccessGroup.accessGroupName,
rwAccessType: "RDONLY",
ipv6SourceCidrIp: "::1",
userAccessType: "no_squash",
priority: 1,
fileSystemType: "extreme",
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = random.index.Integer("default",
min=10000,
max=99999)
default_access_group = alicloud.nas.AccessGroup("default",
access_group_type="Vpc",
description="ExtremeAccessGroup",
access_group_name=f"terraform-example-{default['result']}",
file_system_type="extreme")
default_access_rule = alicloud.nas.AccessRule("default",
access_group_name=default_access_group.access_group_name,
rw_access_type="RDONLY",
ipv6_source_cidr_ip="::1",
user_access_type="no_squash",
priority=1,
file_system_type="extreme")
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nas"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"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
}
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultAccessGroup, err := nas.NewAccessGroup(ctx, "default", &nas.AccessGroupArgs{
AccessGroupType: pulumi.String("Vpc"),
Description: pulumi.String("ExtremeAccessGroup"),
AccessGroupName: pulumi.Sprintf("terraform-example-%v", _default.Result),
FileSystemType: pulumi.String("extreme"),
})
if err != nil {
return err
}
_, err = nas.NewAccessRule(ctx, "default", &nas.AccessRuleArgs{
AccessGroupName: defaultAccessGroup.AccessGroupName,
RwAccessType: pulumi.String("RDONLY"),
Ipv6SourceCidrIp: pulumi.String("::1"),
UserAccessType: pulumi.String("no_squash"),
Priority: pulumi.Int(1),
FileSystemType: pulumi.String("extreme"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultAccessGroup = new AliCloud.Nas.AccessGroup("default", new()
{
AccessGroupType = "Vpc",
Description = "ExtremeAccessGroup",
AccessGroupName = $"terraform-example-{@default.Result}",
FileSystemType = "extreme",
});
var defaultAccessRule = new AliCloud.Nas.AccessRule("default", new()
{
AccessGroupName = defaultAccessGroup.AccessGroupName,
RwAccessType = "RDONLY",
Ipv6SourceCidrIp = "::1",
UserAccessType = "no_squash",
Priority = 1,
FileSystemType = "extreme",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.nas.AccessGroup;
import com.pulumi.alicloud.nas.AccessGroupArgs;
import com.pulumi.alicloud.nas.AccessRule;
import com.pulumi.alicloud.nas.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 default_ = new Integer("default", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var defaultAccessGroup = new AccessGroup("defaultAccessGroup", AccessGroupArgs.builder()
.accessGroupType("Vpc")
.description("ExtremeAccessGroup")
.accessGroupName(String.format("terraform-example-%s", default_.result()))
.fileSystemType("extreme")
.build());
var defaultAccessRule = new AccessRule("defaultAccessRule", AccessRuleArgs.builder()
.accessGroupName(defaultAccessGroup.accessGroupName())
.rwAccessType("RDONLY")
.ipv6SourceCidrIp("::1")
.userAccessType("no_squash")
.priority("1")
.fileSystemType("extreme")
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: random:integer
properties:
min: 10000
max: 99999
defaultAccessGroup:
type: alicloud:nas:AccessGroup
name: default
properties:
accessGroupType: Vpc
description: ExtremeAccessGroup
accessGroupName: terraform-example-${default.result}
fileSystemType: extreme
defaultAccessRule:
type: alicloud:nas:AccessRule
name: default
properties:
accessGroupName: ${defaultAccessGroup.accessGroupName}
rwAccessType: RDONLY
ipv6SourceCidrIp: ::1
userAccessType: no_squash
priority: '1'
fileSystemType: extreme
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_name: Optional[str] = None,
file_system_type: Optional[str] = None,
ipv6_source_cidr_ip: Optional[str] = None,
priority: Optional[int] = None,
rw_access_type: Optional[str] = None,
source_cidr_ip: Optional[str] = None,
user_access_type: 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:nas: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.
Constructor example
The following reference example uses placeholder values for all input properties.
var alicloudAccessRuleResource = new AliCloud.Nas.AccessRule("alicloudAccessRuleResource", new()
{
AccessGroupName = "string",
FileSystemType = "string",
Ipv6SourceCidrIp = "string",
Priority = 0,
RwAccessType = "string",
SourceCidrIp = "string",
UserAccessType = "string",
});
example, err := nas.NewAccessRule(ctx, "alicloudAccessRuleResource", &nas.AccessRuleArgs{
AccessGroupName: pulumi.String("string"),
FileSystemType: pulumi.String("string"),
Ipv6SourceCidrIp: pulumi.String("string"),
Priority: pulumi.Int(0),
RwAccessType: pulumi.String("string"),
SourceCidrIp: pulumi.String("string"),
UserAccessType: pulumi.String("string"),
})
var alicloudAccessRuleResource = new AccessRule("alicloudAccessRuleResource", AccessRuleArgs.builder()
.accessGroupName("string")
.fileSystemType("string")
.ipv6SourceCidrIp("string")
.priority(0)
.rwAccessType("string")
.sourceCidrIp("string")
.userAccessType("string")
.build());
alicloud_access_rule_resource = alicloud.nas.AccessRule("alicloudAccessRuleResource",
access_group_name="string",
file_system_type="string",
ipv6_source_cidr_ip="string",
priority=0,
rw_access_type="string",
source_cidr_ip="string",
user_access_type="string")
const alicloudAccessRuleResource = new alicloud.nas.AccessRule("alicloudAccessRuleResource", {
accessGroupName: "string",
fileSystemType: "string",
ipv6SourceCidrIp: "string",
priority: 0,
rwAccessType: "string",
sourceCidrIp: "string",
userAccessType: "string",
});
type: alicloud:nas:AccessRule
properties:
accessGroupName: string
fileSystemType: string
ipv6SourceCidrIp: string
priority: 0
rwAccessType: string
sourceCidrIp: string
userAccessType: 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AccessRule resource accepts the following input properties:
- Access
Group stringName - AccessGroupName.
- File
System stringType - filesystem type. include standard, extreme.
- Ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- Priority int
- Priority.
- Rw
Access stringType - RWAccess.
- Source
Cidr stringIp - SourceCidrIp.
- User
Access stringType - UserAccess.
- Access
Group stringName - AccessGroupName.
- File
System stringType - filesystem type. include standard, extreme.
- Ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- Priority int
- Priority.
- Rw
Access stringType - RWAccess.
- Source
Cidr stringIp - SourceCidrIp.
- User
Access stringType - UserAccess.
- access
Group StringName - AccessGroupName.
- file
System StringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr StringIp - Ipv6SourceCidrIp.
- priority Integer
- Priority.
- rw
Access StringType - RWAccess.
- source
Cidr StringIp - SourceCidrIp.
- user
Access StringType - UserAccess.
- access
Group stringName - AccessGroupName.
- file
System stringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- priority number
- Priority.
- rw
Access stringType - RWAccess.
- source
Cidr stringIp - SourceCidrIp.
- user
Access stringType - UserAccess.
- access_
group_ strname - AccessGroupName.
- file_
system_ strtype - filesystem type. include standard, extreme.
- ipv6_
source_ strcidr_ ip - Ipv6SourceCidrIp.
- priority int
- Priority.
- rw_
access_ strtype - RWAccess.
- source_
cidr_ strip - SourceCidrIp.
- user_
access_ strtype - UserAccess.
- access
Group StringName - AccessGroupName.
- file
System StringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr StringIp - Ipv6SourceCidrIp.
- priority Number
- Priority.
- rw
Access StringType - RWAccess.
- source
Cidr StringIp - SourceCidrIp.
- user
Access StringType - UserAccess.
Outputs
All input properties are implicitly available as output properties. Additionally, the AccessRule resource produces the following output properties:
- Access
Rule stringId - The first ID of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Access
Rule stringId - The first ID of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- access
Rule StringId - The first ID of the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- access
Rule stringId - The first ID of the resource.
- id string
- The provider-assigned unique ID for this managed resource.
- access_
rule_ strid - The first ID of the resource.
- id str
- The provider-assigned unique ID for this managed resource.
- access
Rule StringId - The first ID of the resource.
- 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_name: Optional[str] = None,
access_rule_id: Optional[str] = None,
file_system_type: Optional[str] = None,
ipv6_source_cidr_ip: Optional[str] = None,
priority: Optional[int] = None,
rw_access_type: Optional[str] = None,
source_cidr_ip: Optional[str] = None,
user_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.
- Access
Group stringName - AccessGroupName.
- Access
Rule stringId - The first ID of the resource.
- File
System stringType - filesystem type. include standard, extreme.
- Ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- Priority int
- Priority.
- Rw
Access stringType - RWAccess.
- Source
Cidr stringIp - SourceCidrIp.
- User
Access stringType - UserAccess.
- Access
Group stringName - AccessGroupName.
- Access
Rule stringId - The first ID of the resource.
- File
System stringType - filesystem type. include standard, extreme.
- Ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- Priority int
- Priority.
- Rw
Access stringType - RWAccess.
- Source
Cidr stringIp - SourceCidrIp.
- User
Access stringType - UserAccess.
- access
Group StringName - AccessGroupName.
- access
Rule StringId - The first ID of the resource.
- file
System StringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr StringIp - Ipv6SourceCidrIp.
- priority Integer
- Priority.
- rw
Access StringType - RWAccess.
- source
Cidr StringIp - SourceCidrIp.
- user
Access StringType - UserAccess.
- access
Group stringName - AccessGroupName.
- access
Rule stringId - The first ID of the resource.
- file
System stringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr stringIp - Ipv6SourceCidrIp.
- priority number
- Priority.
- rw
Access stringType - RWAccess.
- source
Cidr stringIp - SourceCidrIp.
- user
Access stringType - UserAccess.
- access_
group_ strname - AccessGroupName.
- access_
rule_ strid - The first ID of the resource.
- file_
system_ strtype - filesystem type. include standard, extreme.
- ipv6_
source_ strcidr_ ip - Ipv6SourceCidrIp.
- priority int
- Priority.
- rw_
access_ strtype - RWAccess.
- source_
cidr_ strip - SourceCidrIp.
- user_
access_ strtype - UserAccess.
- access
Group StringName - AccessGroupName.
- access
Rule StringId - The first ID of the resource.
- file
System StringType - filesystem type. include standard, extreme.
- ipv6Source
Cidr StringIp - Ipv6SourceCidrIp.
- priority Number
- Priority.
- rw
Access StringType - RWAccess.
- source
Cidr StringIp - SourceCidrIp.
- user
Access StringType - UserAccess.
Import
NAS Access Rule can be imported using the id, e.g.
$ pulumi import alicloud:nas/accessRule:AccessRule example <access_group_name>:<file_system_type>:<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.