# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class AccessRule(pulumi.CustomResource):
    access_group_name: pulumi.Output[str]
    """
    Permission group name.
    """
    access_rule_id: pulumi.Output[str]
    """
    The nas access rule ID.
    """
    priority: pulumi.Output[float]
    """
    Priority level. Range: 1-100. Default value: 1.
    """
    rw_access_type: pulumi.Output[str]
    """
    Read-write permission type: RDWR (default), RDONLY.
    """
    source_cidr_ip: pulumi.Output[str]
    """
    Address or address segment.
    """
    user_access_type: pulumi.Output[str]
    """
    User permission type: no_squash (default), root_squash, all_squash.
    """
    def __init__(__self__, resource_name, opts=None, access_group_name=None, priority=None, rw_access_type=None, source_cidr_ip=None, user_access_type=None, __props__=None, __name__=None, __opts__=None):
        """
        Provides a Nas Access Rule resource.
        
        When NAS is activated, the Default VPC Permission Group is automatically generated. It allows all IP addresses in a VPC to access the mount point with full permissions. Full permissions include Read/Write permission with no restriction on root users.
        
        > **NOTE:** Available in v1.34.0+.
        
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] access_group_name: Permission group name.
        :param pulumi.Input[float] priority: Priority level. Range: 1-100. Default value: 1.
        :param pulumi.Input[str] rw_access_type: Read-write permission type: RDWR (default), RDONLY.
        :param pulumi.Input[str] source_cidr_ip: Address or address segment.
        :param pulumi.Input[str] user_access_type: User permission type: no_squash (default), root_squash, all_squash.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/r/nas_access_rule.html.markdown.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            if access_group_name is None:
                raise TypeError("Missing required property 'access_group_name'")
            __props__['access_group_name'] = access_group_name
            __props__['priority'] = priority
            __props__['rw_access_type'] = rw_access_type
            if source_cidr_ip is None:
                raise TypeError("Missing required property 'source_cidr_ip'")
            __props__['source_cidr_ip'] = source_cidr_ip
            __props__['user_access_type'] = user_access_type
            __props__['access_rule_id'] = None
        super(AccessRule, __self__).__init__(
            'alicloud:nas/accessRule:AccessRule',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, access_group_name=None, access_rule_id=None, priority=None, rw_access_type=None, source_cidr_ip=None, user_access_type=None):
        """
        Get an existing AccessRule resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.
        
        :param str resource_name: The unique name of the resulting resource.
        :param str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] access_group_name: Permission group name.
        :param pulumi.Input[str] access_rule_id: The nas access rule ID.
        :param pulumi.Input[float] priority: Priority level. Range: 1-100. Default value: 1.
        :param pulumi.Input[str] rw_access_type: Read-write permission type: RDWR (default), RDONLY.
        :param pulumi.Input[str] source_cidr_ip: Address or address segment.
        :param pulumi.Input[str] user_access_type: User permission type: no_squash (default), root_squash, all_squash.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/r/nas_access_rule.html.markdown.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()
        __props__["access_group_name"] = access_group_name
        __props__["access_rule_id"] = access_rule_id
        __props__["priority"] = priority
        __props__["rw_access_type"] = rw_access_type
        __props__["source_cidr_ip"] = source_cidr_ip
        __props__["user_access_type"] = user_access_type
        return AccessRule(resource_name, opts=opts, __props__=__props__)
    def translate_output_property(self, prop):
        return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

