diff --git a/src/azure-cli/azure/cli/command_modules/netappfiles/_help.py b/src/azure-cli/azure/cli/command_modules/netappfiles/_help.py index 0613572d418..fb74f49de50 100644 --- a/src/azure-cli/azure/cli/command_modules/netappfiles/_help.py +++ b/src/azure-cli/azure/cli/command_modules/netappfiles/_help.py @@ -26,7 +26,6 @@ short-summary: Create a new Azure NetApp Files (ANF) account. Note that active directories are added using the subgroup commands. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -41,7 +40,6 @@ short-summary: Set/modify the tags for a specified ANF account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -56,7 +54,6 @@ short-summary: Delete the specified ANF account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account examples: - name: Delete an ANF account @@ -78,7 +75,6 @@ short-summary: Get the specified ANF account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account examples: - name: Get an ANF account @@ -98,25 +94,18 @@ short-summary: Add an active directory to the account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account - name: --username - type: string short-summary: Username of Active Directory domain administrator - name: --password - type: string short-summary: Plain text password of Active Directory domain administrator - name: --domain - type: string short-summary: Name of the Active Directory domain - name: --dns - type: string short-summary: Comma separated list of DNS server IP addresses for the Active Directory domain - name: --smb-server-name - type: string short-summary: NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. Must be 10 characters or less - name: --organizational-unit - type: string short-summary: The Organizational Unit (OU) within the Windows Active Directory examples: - name: Add an active directory to the account @@ -129,7 +118,6 @@ short-summary: List the active directories of an account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account examples: - name: Add an active directory to the account @@ -142,10 +130,8 @@ short-summary: Remove an active directory from the account. parameters: - name: --account-name --name -a -n - type: string short-summary: The name of the ANF account - name: --active-directory - type: string short-summary: The id of the active directory examples: - name: Remove an active directory from the account @@ -166,16 +152,12 @@ short-summary: Create a new Azure NetApp Files (ANF) pool. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --name --pool-name -n -p - type: string short-summary: The name of the ANF pool - name: --size - type: integer short-summary: The size for the ANF pool. Must be an integer number of tebibytes in multiples of 4 - name: --service-level - type: string short-summary: The service level for the ANF pool - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -190,16 +172,12 @@ short-summary: Update the tags of the specified ANF pool. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --name --pool-name -n -p - type: string short-summary: The name of the ANF pool - name: --size - type: integer short-summary: The size for the ANF pool. Must be an integer number of tebibytes in multiples of 4 - name: --service-level - type: string short-summary: The service level for the ANF pool - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -214,10 +192,8 @@ short-summary: Delete the specified ANF pool. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --name --pool-name -n -p - type: string short-summary: The name of the ANF pool examples: - name: Delete an ANF pool @@ -230,7 +206,6 @@ short-summary: L:ist the ANF pools for the specified account. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account examples: - name: List the pools for the ANF account @@ -243,10 +218,8 @@ short-summary: Get the specified ANF pool. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --name --pool-name -n -p - type: string short-summary: The name of the ANF pool examples: - name: Get an ANF pool @@ -266,28 +239,20 @@ short-summary: Create a new Azure NetApp Files (ANF) volume. Export policies are applied with the subgroup commands but note that volumes are always created with a default export policy parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume - name: --service-level - type: string short-summary: The service level - name: --usage-threshold - type: int short-summary: The maximum storage quota allowed for a file system as integer number of GiB. Min 100 GiB, max 100TiB" - name: --creation-token - type: string short-summary: A 1-80 character long alphanumeric string value that identifies a unique file share or mount point in the target subnet - name: --vnet - type: string short-summary: The vnet for the volume - name: --subnet - type: string short-summary: The subnet. If omitted 'default' will be used - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -302,19 +267,14 @@ short-summary: Update the specified ANF volume with the values provided. Unspecified values will remain unchanged. Export policies are amended/created with the subgroup commands parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume - name: --service-level - type: string short-summary: The service level - name: --usage-threshold - type: int short-summary: The maximum storage quota allowed for a file system as integer number of GiB. Min 100 GiB, max 100TiB" - name: --tags short-summary: Space-separated tags in `key[=value]` format @@ -329,13 +289,10 @@ short-summary: Delete the specified ANF volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume examples: - name: Delete an ANF volume @@ -348,10 +305,8 @@ short-summary: List the ANF Pools for the specified account. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool examples: - name: List the ANF volumes of the pool @@ -364,13 +319,10 @@ short-summary: Get the specified ANF volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF pool examples: - name: Returns the properties of the given ANF volume @@ -390,34 +342,24 @@ short-summary: Add a new rule to the export policy for a volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume - name: --rule-index - type: string short-summary: Order index. No number can be repeated. Max 6 rules. - name: --unix-read-only - type: string - short-summary: Flag indicating read only access + short-summary: Indication of read only access - name: --unix-read-write - type: string short-summary: Indication of read and write access - name: --cifs - type: string short-summary: Indication that CIFS protocol is allowed - name: --nfsv3 - type: string short-summary: Indication that NFSv3 protocol is allowed - name: --nfsv4 - type: string short-summary: Indication that NFSv4 protocol is allowed - name: --allowed-clients - type: string short-summary: Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names) examples: - name: Add an export policy rule for the ANF volume @@ -430,13 +372,10 @@ short-summary: List the export policy rules for a volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume examples: - name: List the export policy rules for an ANF volume @@ -449,16 +388,12 @@ short-summary: Remove a rule from the export policy for a volume by rule index. The current rules can be obtained by performing the subgroup list command. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --name --volume-name -n -v - type: string short-summary: The name of the ANF volume - name: --rule-index - type: string short-summary: Order index. Range 1 to 6. examples: - name: Remove an export policy rule for an ANF volume @@ -473,13 +408,10 @@ short-summary: List the mount targets of an Azure NetApp Files (ANF) volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --volume-name -v - type: string short-summary: The name of the ANF pool examples: - name: list the mount targets of an ANF volume @@ -499,19 +431,14 @@ short-summary: Create a new Azure NetApp Files (ANF) snapshot. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --volume-name -v - type: string short-summary: The name of the ANF volume - name: --name --snapshot-name -n -s - type: string short-summary: The name of the ANF snapshot - name: --file-system-id - type: string short-summary: The uuid of the volume examples: - name: Create an ANF snapshot @@ -524,16 +451,12 @@ short-summary: Delete the specified ANF snapshot. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --volume-name -v - type: string short-summary: The name of the ANF volume - name: --name --snapshot-name -n -s - type: string short-summary: The name of the ANF snapshot examples: - name: Delete an ANF snapshot @@ -546,13 +469,10 @@ short-summary: List the snapshots of an ANF volume. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --volume-name -v - type: string short-summary: The name of the ANF volume examples: - name: list the snapshots of an ANF volume @@ -565,16 +485,12 @@ short-summary: Get the specified ANF snapshot. parameters: - name: --account-name -a - type: string short-summary: The name of the ANF account - name: --pool-name -p - type: string short-summary: The name of the ANF pool - name: --volume-name -v - type: string short-summary: The name of the ANF volume - name: --name --snapshot-name -n -s - type: string short-summary: The name of the ANF snapshot examples: - name: Return the specified ANF snapshot diff --git a/src/azure-cli/azure/cli/command_modules/netappfiles/_params.py b/src/azure-cli/azure/cli/command_modules/netappfiles/_params.py index f39eeb77440..cdc18e09f1d 100644 --- a/src/azure-cli/azure/cli/command_modules/netappfiles/_params.py +++ b/src/azure-cli/azure/cli/command_modules/netappfiles/_params.py @@ -4,7 +4,7 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long -from azure.cli.core.commands.parameters import tags_type, resource_group_name_type, get_enum_type +from azure.cli.core.commands.parameters import tags_type, resource_group_name_type, get_enum_type, get_three_state_flag from knack.arguments import CLIArgumentType @@ -53,6 +53,13 @@ def load_arguments(self, _): c.argument('pool_name', pool_name_type, id_part=None) c.argument('volume_name', volume_name_type, options_list=['--volume-name', '-v', '--name', '-n'], id_part=None) + with self.argument_context('netappfiles volume export-policy add') as c: + c.argument('unix_read_only', help="Indication of read only access", arg_type=get_three_state_flag()) + c.argument('unix_read_write', help="Indication of read and write access", arg_type=get_three_state_flag()) + c.argument('cifs', help="Indication that CIFS protocol is allowed", arg_type=get_three_state_flag()) + c.argument('nfsv3', help="Indication that NFSv3 protocol is allowed", arg_type=get_three_state_flag()) + c.argument('nfsv4', help="Indication that NFSv4 protocol is allowed", arg_type=get_three_state_flag()) + with self.argument_context('netappfiles snapshot') as c: c.argument('account_name', account_name_type) c.argument('pool_name', pool_name_type) diff --git a/src/azure-cli/azure/cli/command_modules/netappfiles/custom.py b/src/azure-cli/azure/cli/command_modules/netappfiles/custom.py index 2b6c9bd4209..118d5275973 100644 --- a/src/azure-cli/azure/cli/command_modules/netappfiles/custom.py +++ b/src/azure-cli/azure/cli/command_modules/netappfiles/custom.py @@ -16,10 +16,6 @@ tib_scale = gib_scale * 1024 -def str2bool(v): - return v.lower() in ("yes", "true", "t", "1") - - def _update_mapper(existing, new, keys): for key in keys: existing_value = getattr(existing, key) @@ -120,7 +116,7 @@ def patch_volume(cmd, instance, usage_threshold=None, service_level=None, tags=N def add_export_policy_rule(cmd, instance, allowed_clients, rule_index, unix_read_only, unix_read_write, cifs, nfsv3, nfsv4): rules = [] - export_policy = ExportPolicyRule(rule_index=rule_index, unix_read_only=str2bool(unix_read_only), unix_read_write=str2bool(unix_read_write), cifs=str2bool(cifs), nfsv3=str2bool(nfsv3), nfsv4=str2bool(nfsv4), allowed_clients=allowed_clients) + export_policy = ExportPolicyRule(rule_index=rule_index, unix_read_only=unix_read_only, unix_read_write=unix_read_write, cifs=cifs, nfsv3=nfsv3, nfsv4=nfsv4, allowed_clients=allowed_clients) rules.append(export_policy) for rule in instance.export_policy.rules: