Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR hardware-security-modules] Remove all schema readme #3255

Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@

from azure.cli.core import AzCommandsLoader
from azext_hardware_security_modules.generated._help import helps # pylint: disable=unused-import
try:
from azext_hardware_security_modules.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class AzureDedicatedHSMResourceProviderCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_hardware_security_modules.generated._client_factory import cf_hardwaresecuritymodules
hardwaresecuritymodules_custom = CliCommandType(
from azext_hardware_security_modules.generated._client_factory import cf_hardware_security_modules_cl
hardware_security_modules_custom = CliCommandType(
operations_tmpl='azext_hardware_security_modules.custom#{}',
client_factory=cf_hardwaresecuritymodules)
super(AzureDedicatedHSMResourceProviderCommandsLoader,
self).__init__(
cli_ctx=cli_ctx, custom_command_type=hardwaresecuritymodules_custom)
client_factory=cf_hardware_security_modules_cl)
parent = super(AzureDedicatedHSMResourceProviderCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=hardware_security_modules_custom)

def load_command_table(self, args):
from azext_hardware_security_modules.generated.commands import load_command_table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
"azext.minCliCoreVersion": "2.15.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
# --------------------------------------------------------------------------


def cf_hardwaresecuritymodules(cli_ctx, *_):
def cf_hardware_security_modules_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.hardwaresecuritymodules import AzureDedicatedHSMResourceProvider
return get_mgmt_service_client(cli_ctx, AzureDedicatedHSMResourceProvider)
from azext_hardware_security_modules.vendored_sdks.hardwaresecuritymodules import AzureDedicatedHSMResourceProvider
return get_mgmt_service_client(cli_ctx,
AzureDedicatedHSMResourceProvider)


def cf_dedicated_hsm(cli_ctx, *_):
return cf_hardwaresecuritymodules(cli_ctx).dedicated_hsm
return cf_hardware_security_modules_cl(cli_ctx).dedicated_hsm
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,97 @@
from knack.help_files import helps


helps['dedicated-hsm'] = """
helps['hardware-security-modules dedicated-hsm'] = """
type: group
short-summary: dedicated-hsm to create, update, list, show, and delete HSMs
short-summary: Manage dedicated hsm with hardware security modules
"""

helps['dedicated-hsm list'] = """
helps['hardware-security-modules dedicated-hsm list'] = """
type: command
short-summary: The List operation gets information about the dedicated HSMs associated with the resrouce group.
short-summary: "The List operation gets information about the dedicated hsms associated with the subscription and \
within the specified resource group. And The List operation gets information about the dedicated HSMs associated with \
the subscription."
examples:
- name: List dedicated HSM devices in a resource group
text: |-
az dedicated-hsm list -g "hsm-group"
"""

helps['dedicated-hsm list'] = """
type: command
short-summary: The List operation gets information about the dedicated HSMs associated with the subscription.
examples:
az hardware-security-modules dedicated-hsm list --resource-group "hsm-group"
- name: List dedicated HSM devices in a subscription
text: |-
az dedicated-hsm list
az hardware-security-modules dedicated-hsm list
"""

helps['dedicated-hsm show'] = """
helps['hardware-security-modules dedicated-hsm show'] = """
type: command
short-summary: Gets the specified Azure dedicated HSM.
short-summary: "Gets the specified Azure dedicated HSM."
examples:
- name: Get a dedicated HSM
text: |-
az dedicated-hsm show -n "hsm1" -g "hsm-group"
az hardware-security-modules dedicated-hsm show --name "hsm1" --resource-group "hsm-group"
"""

helps['dedicated-hsm create'] = """
helps['hardware-security-modules dedicated-hsm create'] = """
type: command
short-summary: Create a dedicated HSM in the specified subscription.
short-summary: "Create a dedicated HSM in the specified subscription."
parameters:
- name: --subnet
short-summary: "Specifies the identifier of the subnet."
long-summary: |
Usage: --subnet id=XX

id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/.\
..
- name: --network-interfaces
short-summary: "Specifies the list of resource Ids for the network interfaces associated with the dedicated \
HSM."
long-summary: |
Usage: --network-interfaces private-ip-address=XX

private-ip-address: Private Ip address of the interface

Multiple actions can be specified by using more than one --network-interfaces argument.
examples:
- name: Create a new dedicated HSM
- name: Create a new or update an existing dedicated HSM
text: |-
az dedicated-hsm create -n "hsm1" -l "japanwest" -i private-ip-address="1.0.0.1" \
-s id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/hsm/subnets/hsm" \
--stamp-id "stamp1" --sku name="SafeNet Luna Network HSM A790" --tags Dept="hsm" Environment="dogfood" -g "hsm-group"
az hardware-security-modules dedicated-hsm create --name "hsm1" --location "westus" \
--network-interfaces private-ip-address="1.0.0.1" --subnet id="/subscriptions/00000000-0000-0000-0000-000000000000/reso\
urceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01" --stamp-id "stamp01" --tags \
Dept="hsm" Environment="dogfood" --resource-group "hsm-group"
"""

helps['dedicated-hsm update'] = """
helps['hardware-security-modules dedicated-hsm update'] = """
type: command
short-summary: Update a dedicated HSM in the specified subscription.
short-summary: "Update a dedicated HSM in the specified subscription."
examples:
- name: Update an existing dedicated HSM
text: |-
az dedicated-hsm update -n "hsm1" --tags Dept="hsm" Environment="dogfood" Sl\
ice="A" -g "hsm-group"
az hardware-security-modules dedicated-hsm update --name "hsm1" --tags Dept="hsm" Environment="dogfood" \
Slice="A" --resource-group "hsm-group"
"""

helps['dedicated-hsm delete'] = """
helps['hardware-security-modules dedicated-hsm delete'] = """
type: command
short-summary: Deletes the specified Azure Dedicated HSM.
short-summary: "Deletes the specified Azure Dedicated HSM."
examples:
- name: Delete a dedicated HSM
text: |-
az dedicated-hsm delete -n "hsm1" -g "hsm-group"
az hardware-security-modules dedicated-hsm delete --name "hsm1" --resource-group "hsm-group"
"""

helps['dedicated-hsm wait'] = """
helps['hardware-security-modules dedicated-hsm wait'] = """
type: command
short-summary: Waits for operation to complete
short-summary: Place the CLI in a waiting state until a condition of the hardware-security-modules dedicated-hsm \
is met.
examples:
- name: Delete a dedicated HSM
- name: Pause executing next line of CLI script until the hardware-security-modules dedicated-hsm is \
successfully created.
text: |-
az hardware-security-modules dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --created
- name: Pause executing next line of CLI script until the hardware-security-modules dedicated-hsm is \
successfully updated.
text: |-
az hardware-security-modules dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --updated
- name: Pause executing next line of CLI script until the hardware-security-modules dedicated-hsm is \
successfully deleted.
text: |-
az dedicated-hsm wait --created -g "hsm-group" --name "hsm1"
az hardware-security-modules dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --deleted
"""
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,50 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
tags_type,
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azext_hardware_security_modules.action import (
AddNetworkProfileSubnet,
AddNetworkProfileNetworkInterfaces
AddSubnet,
AddNetworkInterfaces
)


def load_arguments(self, _):

with self.argument_context('dedicated-hsm list') as c:
with self.argument_context('hardware-security-modules dedicated-hsm list') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('top', help='Maximum number of results to return.')
c.argument('top', type=int, help='Maximum number of results to return.')

with self.argument_context('dedicated-hsm show') as c:
with self.argument_context('hardware-security-modules dedicated-hsm show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dedicated HSM.')
c.argument('name', type=str, help='The name of the dedicated HSM.', id_part='name')

with self.argument_context('dedicated-hsm create') as c:
with self.argument_context('hardware-security-modules dedicated-hsm create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=[
'--name', '-n'], help='Name of the dedicated Hsm')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
c.argument('name', type=str, help='Name of the dedicated Hsm')
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('sku', type=str,
help='The HSM device SKU if a non-standard HSM is wanted (default is: SafeNet Luna Network HSM A790)')
c.argument('zones', nargs='+',
help='The Dedicated Hsm zones.')
c.argument('zones', nargs='+', help='The Dedicated Hsm zones.')
c.argument('tags', tags_type)
c.argument(
'stamp_id', help='This field will be used when RP does not support Availability zones.')
c.argument('network_profile_subnet', arg_group='network profile', options_list=['--subnet', '-s'], action=AddNetworkProfileSubnet, nargs='+', help='Specifies the identifier '
'of the subnet. Expected value: id=xx.')
c.argument('network_profile_network_interfaces', options_list=['--network-profile-network-interfaces', '-i'], action=AddNetworkProfileNetworkInterfaces, nargs='+', help='Sp'
'ecifies a list of ip address from the specfied subnet for the network interfaces associated with the dedicated HSM. Expe'
'cted value: -i private-ip-address=xx.')
c.argument('stamp_id', type=str, help='This field will be used when RP does not support Availability zones.')
c.argument('subnet', action=AddSubnet, nargs='+', help='Specifies the identifier of the subnet.',
arg_group='Network Profile')
c.argument('network_interfaces', action=AddNetworkInterfaces, nargs='+', help='Specifies the list of resource '
'Ids for the network interfaces associated with the dedicated HSM.', arg_group='Network Profile')

with self.argument_context('dedicated-hsm update') as c:
with self.argument_context('hardware-security-modules dedicated-hsm update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=[
'--name', '-n'], help='Name of the dedicated HSM')
c.argument('name', type=str, help='Name of the dedicated HSM', id_part='name')
c.argument('tags', tags_type)

with self.argument_context('dedicated-hsm delete') as c:
with self.argument_context('hardware-security-modules dedicated-hsm delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', options_list=[
'--name', '-n'], help='The name of the dedicated HSM to delete')
c.argument('name', type=str, help='The name of the dedicated HSM to delete', id_part='name')

with self.argument_context('hardware-security-modules dedicated-hsm wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('name', type=str, help='The name of the dedicated HSM.', id_part='name')
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

VERSION = "2019-05-01T00:00:00.000Z"
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# pylint: disable=protected-access

import argparse
from knack.util import CLIError
from collections import defaultdict
from knack.util import CLIError


class AddNetworkProfileSubnet(argparse.Action):
class AddSubnet(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
namespace.network_profile_subnet = action
namespace.subnet = action

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
Expand All @@ -33,13 +33,15 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
v = properties[k]
if kl == 'id':
d['id'] = v[0]
else:
raise CLIError('Unsupported Key {} is provided for parameter subnet. All possible keys are: id'.format(k))
return d


class AddNetworkProfileNetworkInterfaces(argparse._AppendAction):
class AddNetworkInterfaces(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
action = self.get_action(values, option_string)
super(AddNetworkProfileNetworkInterfaces, self).__call__(parser, namespace, action, option_string)
super(AddNetworkInterfaces, self).__call__(parser, namespace, action, option_string)

def get_action(self, values, option_string): # pylint: disable=no-self-use
try:
Expand All @@ -55,4 +57,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
v = properties[k]
if kl == 'private-ip-address':
d['private_ip_address'] = v[0]
else:
raise CLIError('Unsupported Key {} is provided for parameter network_interfaces. All possible keys '
'are: private-ip-address'.format(k))
return d
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals

from azure.cli.core.commands import CliCommandType


def load_command_table(self, _):

from azext_hardware_security_modules.generated._client_factory import cf_dedicated_hsm
hardwaresecuritymodules_dedicated_hsm = CliCommandType(
operations_tmpl='azext_hardware_security_modules.vendored_sdks.hardwaresecuritymodules.operations._dedicated_hsm_'
'operations#DedicatedHsmOperations.{}',
hardware_security_modules_dedicated_hsm = CliCommandType(
operations_tmpl='azext_hardware_security_modules.vendored_sdks.hardwaresecuritymodules.operations._dedicated_hs'
'm_operations#DedicatedHsmOperations.{}',
client_factory=cf_dedicated_hsm)
with self.command_group('dedicated-hsm', hardwaresecuritymodules_dedicated_hsm,
client_factory=cf_dedicated_hsm, is_experimental=True) as g:
g.custom_command('list', 'hardwaresecuritymodules_dedicated_hsm_list')
g.custom_show_command(
'show', 'hardwaresecuritymodules_dedicated_hsm_show')
g.custom_command(
'create', 'hardwaresecuritymodules_dedicated_hsm_create', supports_no_wait=True)
g.custom_command(
'update', 'hardwaresecuritymodules_dedicated_hsm_update', supports_no_wait=True)
g.custom_command('delete', 'hardwaresecuritymodules_dedicated_hsm_delete',
supports_no_wait=True, confirmation=True)
g.wait_command('wait')
with self.command_group('hardware-security-modules dedicated-hsm', hardware_security_modules_dedicated_hsm,
client_factory=cf_dedicated_hsm) as g:
g.custom_command('list', 'hardware_security_modules_dedicated_hsm_list')
g.custom_show_command('show', 'hardware_security_modules_dedicated_hsm_show')
g.custom_command('create', 'hardware_security_modules_dedicated_hsm_create', supports_no_wait=True)
g.custom_command('update', 'hardware_security_modules_dedicated_hsm_update', supports_no_wait=True)
g.custom_command('delete', 'hardware_security_modules_dedicated_hsm_delete', supports_no_wait=True,
confirmation=True)
g.custom_wait_command('wait', 'hardware_security_modules_dedicated_hsm_show')

with self.command_group('hardware-security-modules', is_experimental=True):
pass
Loading