Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/azure-cli/azure/cli/command_modules/keyvault/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@
short-summary: Manage vault network ACLs.
"""

helps['keyvault private-endpoint'] = """
helps['keyvault private-endpoint-connection'] = """
type: group
short-summary: Manage vault private endpoint connections.
"""

helps['keyvault private-endpoint delete'] = """
helps['keyvault private-endpoint-connection delete'] = """
type: command
short-summary: Delete the specified private endpoint connection associated with a Key Vault.
"""

helps['keyvault private-endpoint show'] = """
helps['keyvault private-endpoint-connection show'] = """
type: command
short-summary: Show details of a private endpoint connection associated with a Key Vault.
"""
Expand Down
14 changes: 7 additions & 7 deletions src/azure-cli/azure/cli/command_modules/keyvault/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@ class CLIJsonWebKeyOperation(str, Enum):
c.argument('subnet', help='Name or ID of subnet. If name is supplied, `--vnet-name` must be supplied.')
c.argument('vnet_name', help='Name of a virtual network.', validator=validate_subnet)

with self.argument_context('keyvault private-endpoint', min_api='2018-02-14') as c:
with self.argument_context('keyvault private-endpoint-connection', min_api='2018-02-14') as c:
c.argument('approval_description', help='Comments for the approval.')
c.argument('private_endpoint_connection_name', options_list=['--connection-name', '-n'], required=False,
c.argument('private_endpoint_connection_name', options_list=['--name', '-n'], required=False,
help='The name of the private endpoint connection associated with the Key Vault. '
'Required if --connection-id is not specified')
'Required if --id is not specified')
c.argument('vault_name', vault_name_type, required=False,
help='Name of the Key Vault. Required if --connection-id is not specified')
help='Name of the Key Vault. Required if --id is not specified')
c.argument('rejection_description', help='Comments for the rejection.')

for item in ['approve', 'reject', 'delete', 'show']:
with self.argument_context('keyvault private-endpoint {}'.format(item), min_api='2018-02-14') as c:
c.extra('connection_id', required=False,
with self.argument_context('keyvault private-endpoint-connection {}'.format(item), min_api='2018-02-14') as c:
c.extra('connection_id', options_list=['--id'], required=False,
help='The ID of the private endpoint connection associated with the Key Vault. '
'If specified --vault-name and --connection-name/-n, this should be omitted.')
'If specified --vault-name and --name/-n, this should be omitted.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think connection-id and connection-name could be consolidated into one parameter connection. It can support both a name or id. You already has a validator to parse id.

Parameter names need to be changed in the error message in validator as well.

None, 'you don\'t need to specify --connection-name/-n or --vault-name if --connection-id is specified')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fengzhou-msft Thanks for pointing it out, for the consistency concern, I prefer to maintain the status quo as we already have commands like az keyvault key show, they use both --id and --name/-n, the change for these commands would be a breaking change, we can revisit this later:

(env3) C:\repos\azure-cli>az keyvault key show -h

Command
    az keyvault key show : Gets the public part of a stored key.
        The get key operation is applicable to all key types. If the requested key is symmetric,
        then no key material is released in the response. This operation requires the keys/get
        permission.

Arguments

Id Arguments
    --id           : Id of the key.  If specified all other 'Id' arguments should be omitted.
    --name -n      : Name of the key. Required if --id is not specified.
    --vault-name   : Name of the key vault. Required if --id is not specified.
    --version -v   : The key version. If omitted, uses the latest version.

However, you pointed out a typo I ignored, many thanks!
--connection-id -> --id
--connection-name -> --name

None, 'specify both: --connection-name/-n and --vault-name')

None, 'you don\'t need to specify --connection-name/-n or --vault-name if --connection-id is specified')


with self.argument_context('keyvault private-link-resource', min_api='2018-02-14') as c:
c.argument('vault_name', vault_name_type, required=True, help='Name of the Key Vault.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def load_command_table(self, _):
g.custom_command('remove', 'remove_network_rule')
g.custom_command('list', 'list_network_rules')

with self.command_group('keyvault private-endpoint',
with self.command_group('keyvault private-endpoint-connection',
kv_private_endpoint_connections_sdk,
min_api='2018-02-14',
client_factory=keyvault_client_private_endpoint_connections_factory,
Expand Down
Loading