diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/_validators.py b/src/hardware-security-modules/azext_hardware_security-modules/generated/_validators.py deleted file mode 100644 index 7536d0531ea..00000000000 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/_validators.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# 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. -# -------------------------------------------------------------------------- - - -def example_name_or_id_validator(cmd, namespace): - from azure.cli.core.commands.client_factory import get_subscription_id - from msrestazure.tools import is_valid_resource_id, resource_id - if namespace.storage_account: - if not is_valid_resource_id(namespace.RESOURCE): - namespace.storage_account = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=namespace.resource_group_name, - namespace='Microsoft.Storage', - type='storageAccounts', - name=namespace.storage_account - ) diff --git a/src/hardware-security-modules/azext_hardware_security-modules/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/__init__.py similarity index 87% rename from src/hardware-security-modules/azext_hardware_security-modules/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/__init__.py index 827042f6a55..70d30460db5 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/__init__.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/__init__.py @@ -20,8 +20,8 @@ def __init__(self, cli_ctx=None): hardware_security_modules_custom = CliCommandType( operations_tmpl='azext_hardware_security_modules.custom#{}', client_factory=cf_hardware_security_modules) - super(AzureDedicatedHSMResourceProviderCommandsLoader, self).__init__(cli_ctx=cli_ctx, - custom_command_type=hardware_security_modules_custom) + 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 diff --git a/src/hardware-security-modules/azext_hardware_security-modules/action.py b/src/hardware-security-modules/azext_hardware_security_modules/action.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/action.py rename to src/hardware-security-modules/azext_hardware_security_modules/action.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/azext_metadata.json b/src/hardware-security-modules/azext_hardware_security_modules/azext_metadata.json similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/azext_metadata.json rename to src/hardware-security-modules/azext_hardware_security_modules/azext_metadata.json diff --git a/src/hardware-security-modules/azext_hardware_security-modules/custom.py b/src/hardware-security-modules/azext_hardware_security_modules/custom.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/custom.py rename to src/hardware-security-modules/azext_hardware_security_modules/custom.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/__init__.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/__init__.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/_client_factory.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/_client_factory.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/_client_factory.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/_client_factory.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/_help.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/_help.py similarity index 57% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/_help.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/_help.py index 440f4871ac9..477c855cf7d 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/_help.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/_help.py @@ -38,13 +38,29 @@ helps['hardware-security-modules dedicated-hsm create'] = """ type: command short-summary: Create or Update a dedicated HSM in the specified subscription. + parameters: + - name: --network-profile-subnet + short-summary: Specifies the identifier of the subnet. + long-summary: | + Usage: --network-profile-subnet id=XX + + id: The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/.\ +.. + - name: --network-profile-network-interfaces + short-summary: Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. + long-summary: | + Usage: --network-profile-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-profile-network-interfaces argument. examples: - name: Create a new or update an existing dedicated HSM text: |- az hardware-security-modules dedicated-hsm create --name "hsm1" --location "westus" --network-profile-ne\ twork-interfaces private-ip-address="1.0.0.1" --network-profile-subnet id="/subscriptions/00000000-0000-0000-0000-00000\ 0000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01" --stamp-id "stamp\ -01" --sku name="SafeNet Luna Network HSM A790" --tags Dept="hsm" Environment="dogfood" --resource-group "hsm-group" +01" --tags Dept="hsm" Environment="dogfood" --resource-group "hsm-group" """ helps['hardware-security-modules dedicated-hsm update'] = """ @@ -65,3 +81,22 @@ text: |- az hardware-security-modules dedicated-hsm delete --name "hsm1" --resource-group "hsm-group" """ + +helps['hardware-security-modules dedicated-hsm wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the hardware-security-modules dedicated-hsm is\ + met. + examples: + - 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 hardware-security-modules dedicated-hsm wait --name "hsm1" --resource-group "hsm-group" --deleted +""" diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/_params.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/_params.py similarity index 83% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/_params.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/_params.py index 12474fc65cc..362f8271d84 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/_params.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/_params.py @@ -10,7 +10,6 @@ # 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, @@ -18,7 +17,6 @@ ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from azext_hardware_security_modules.action import ( - AddSku, AddNetworkProfileSubnet, AddNetworkProfileNetworkInterfaces ) @@ -32,28 +30,30 @@ def load_arguments(self, _): with self.argument_context('hardware-security-modules dedicated-hsm show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('name', help='The name of the dedicated HSM.') + c.argument('name', help='The name of the dedicated HSM.', id_part='name') with self.argument_context('hardware-security-modules dedicated-hsm create') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', help='Name of the dedicated Hsm') c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='SKU details Expect value: KEY1=VALUE1 KEY2=VALUE2 ...') - c.argument('zones', nargs='+', help='The Dedicated Hsm zones. Expected value: json-string/@json-file.') + 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', action=AddNetworkProfileSubnet, nargs='+', help='Specifies the identifier ' - 'of the subnet. Expect value: id=xx.') + 'of the subnet.') c.argument('network_profile_network_interfaces', action=AddNetworkProfileNetworkInterfaces, nargs='+', help='Sp' - 'ecifies the list of resource Ids for the network interfaces associated with the dedicated HSM. Expe' - 'ct value: private-ip-address=xx.') + 'ecifies the list of resource Ids for the network interfaces associated with the dedicated HSM.') with self.argument_context('hardware-security-modules dedicated-hsm update') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('name', help='Name of the dedicated HSM') + c.argument('name', help='Name of the dedicated HSM', id_part='name') c.argument('tags', tags_type) with self.argument_context('hardware-security-modules dedicated-hsm delete') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('name', help='The name of the dedicated HSM to delete') + c.argument('name', 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', help='The name of the dedicated HSM.', id_part='name') diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_version.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/_validators.py similarity index 79% rename from src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_version.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/_validators.py index fe0d5a0b414..e5ac7838677 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_version.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/_validators.py @@ -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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2019-05-01T00:00:00.000Z" +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# -------------------------------------------------------------------------- diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/action.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/action.py similarity index 74% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/action.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/action.py index 2105cecaaa2..ed2b6ba242b 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/action.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/action.py @@ -14,33 +14,11 @@ from collections import defaultdict -class AddSku(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - action = self.get_action(values, option_string) - namespace.sku = action - - - def get_action(self, values, option_string): # pylint: disable=no-self-use - try: - properties = defaultdict(list) - for (k, v) in (x.split('=', 1) for x in values): - properties[k].append(v) - properties = dict(properties) - except ValueError: - raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) - d = {} - for k in properties: - kl = k.lower() - v = properties[k] - return d - - class AddNetworkProfileSubnet(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) namespace.network_profile_subnet = action - def get_action(self, values, option_string): # pylint: disable=no-self-use try: properties = defaultdict(list) @@ -63,7 +41,6 @@ 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) - def get_action(self, values, option_string): # pylint: disable=no-self-use try: properties = defaultdict(list) diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/commands.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/commands.py similarity index 93% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/commands.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/commands.py index 56a1ad9b571..170c1f48a77 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/commands.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/commands.py @@ -25,4 +25,4 @@ def load_command_table(self, _): 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) - g.wait_command('wait') + g.custom_wait_command('wait', 'hardware_security_modules_dedicated_hsm_show') diff --git a/src/hardware-security-modules/azext_hardware_security-modules/generated/custom.py b/src/hardware-security-modules/azext_hardware_security_modules/generated/custom.py similarity index 50% rename from src/hardware-security-modules/azext_hardware_security-modules/generated/custom.py rename to src/hardware-security-modules/azext_hardware_security_modules/generated/custom.py index d1c85452fb6..02e9f82780b 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/generated/custom.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/generated/custom.py @@ -10,58 +10,65 @@ # pylint: disable=too-many-lines import json +from azure.cli.core.util import sdk_no_wait -def hardware_security_modules_dedicated_hsm_list(cmd, client, +def hardware_security_modules_dedicated_hsm_list(client, resource_group_name=None, top=None): - if resource_group_name is not None: + if resource_group_name: return client.list_by_resource_group(resource_group_name=resource_group_name, top=top) return client.list_by_subscription(top=top) -def hardware_security_modules_dedicated_hsm_show(cmd, client, +def hardware_security_modules_dedicated_hsm_show(client, resource_group_name, name): return client.get(resource_group_name=resource_group_name, name=name) -def hardware_security_modules_dedicated_hsm_create(cmd, client, +def hardware_security_modules_dedicated_hsm_create(client, resource_group_name, name, location, - sku=None, zones=None, tags=None, stamp_id=None, network_profile_subnet=None, - network_profile_network_interfaces=None): - if isinstance(zones, str): - zones = json.loads(zones) - return client.begin_create_or_update(resource_group_name=resource_group_name, - name=name, - location=location, - sku=sku, - zones=zones, - tags=tags, - stamp_id=stamp_id, - subnet=network_profile_subnet, - network_interfaces=network_profile_network_interfaces) + network_profile_network_interfaces=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_group_name=resource_group_name, + name=name, + location=location, + sku=json.loads("{\"name\": \"SafeNet Luna Network HSM A790\"}"), + zones=zones, + tags=tags, + stamp_id=stamp_id, + subnet=network_profile_subnet, + network_interfaces=network_profile_network_interfaces) -def hardware_security_modules_dedicated_hsm_update(cmd, client, +def hardware_security_modules_dedicated_hsm_update(client, resource_group_name, name, - tags=None): - return client.begin_update(resource_group_name=resource_group_name, - name=name, - tags=tags) + tags=None, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + name=name, + tags=tags) -def hardware_security_modules_dedicated_hsm_delete(cmd, client, +def hardware_security_modules_dedicated_hsm_delete(client, resource_group_name, - name): - return client.begin_delete(resource_group_name=resource_group_name, - name=name) + name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + name=name) diff --git a/src/hardware-security-modules/azext_hardware_security-modules/manual/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/manual/__init__.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/manual/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/manual/__init__.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/tests/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/tests/__init__.py similarity index 57% rename from src/hardware-security-modules/azext_hardware_security-modules/tests/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/tests/__init__.py index fe1bd438b46..5f8f1fd97ad 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/tests/__init__.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/tests/__init__.py @@ -10,9 +10,14 @@ # -------------------------------------------------------------------------- import inspect import os +import sys +import traceback +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError __path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] def try_manual(func): @@ -34,6 +39,7 @@ def get_func_to_call(): func_to_call = func try: func_to_call = import_manual_function(func) + print("Found manual override for {}(...)".format(func.__name__)) except (ImportError, AttributeError): pass return func_to_call @@ -41,9 +47,25 @@ def get_func_to_call(): def wrapper(*args, **kwargs): func_to_call = get_func_to_call() print("running {}()...".format(func.__name__)) - return func_to_call(*args, **kwargs) + try: + return func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, JMESPathCheckAssertionError) as e: + print("--------------------------------------") + print("step exception: ", e) + print("--------------------------------------", file=sys.stderr) + print("step exception in {}: {}".format(func.__name__, e), file=sys.stderr) + traceback.print_exc() + exceptions.append((func.__name__, sys.exc_info())) if inspect.isclass(func): return get_func_to_call() - else: - return wrapper + return wrapper + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/hardware-security-modules/azext_hardware_security-modules/tests/latest/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/tests/latest/__init__.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/tests/latest/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/tests/latest/__init__.py diff --git a/src/hardware-security-modules/azext_hardware_security-modules/tests/latest/preparers.py b/src/hardware-security-modules/azext_hardware_security_modules/tests/latest/preparers.py similarity index 56% rename from src/hardware-security-modules/azext_hardware_security-modules/tests/latest/preparers.py rename to src/hardware-security-modules/azext_hardware_security_modules/tests/latest/preparers.py index 3d6672de64f..4702355b2bd 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/tests/latest/preparers.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/tests/latest/preparers.py @@ -10,8 +10,8 @@ import os from datetime import datetime -from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer from azure.cli.testsdk.exceptions import CliTestError from azure.cli.testsdk.reverse_dependency import get_dummy_cli @@ -19,6 +19,7 @@ KEY_RESOURCE_GROUP = 'rg' KEY_VIRTUAL_NETWORK = 'vnet' KEY_VNET_SUBNET = 'subnet' +KEY_VNET_NIC = 'nic' class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): @@ -40,7 +41,7 @@ def __init__(self, name_prefix='clitest.vn', self.resource_group_key = resource_group_key self.dev_setting_name = os.environ.get(dev_setting_name, None) - def create_resource(self, name, **kwargs): + def create_resource(self, name, **_): if self.dev_setting_name: return {self.parameter_name: self.dev_setting_name, } @@ -56,61 +57,103 @@ def create_resource(self, name, **kwargs): tags['job'] = os.environ['ENV_JOB_NAME'] tags = ' '.join(['{}={}'.format(key, value) for key, value in tags.items()]) - template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + template = 'az network vnet create --resource-group {} --name {} --subnet-name default --tag ' + tags self.live_only_execute(self.cli_ctx, template.format( self.resource_group_name, name)) self.test_class_instance.kwargs[self.key] = name return {self.parameter_name: name} - def remove_resource(self, name, **kwargs): + def remove_resource(self, name, **_): # delete vnet if test is being recorded and if the vnet is not a dev rg if not self.dev_setting_name: self.live_only_execute( - self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + self.cli_ctx, + 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): def __init__(self, name_prefix='clitest.vn', parameter_name='subnet', - resource_group_name=None, resource_group_key=KEY_RESOURCE_GROUP, - vnet_name=None, vnet_key=KEY_VIRTUAL_NETWORK, address_prefixes="11.0.0.0/24", dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', - random_name_length=24, key=KEY_VNET_SUBNET): + key=KEY_VNET_SUBNET): if ' ' in name_prefix: raise CliTestError( 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VnetSubnetPreparer, self).__init__( - name_prefix, random_name_length) + super(VnetSubnetPreparer, self).__init__(name_prefix, 15) self.cli_ctx = get_dummy_cli() self.parameter_name = parameter_name self.key = key - self.resource_group_name = resource_group_name - self.resource_group_key = resource_group_key - self.vnet_name = vnet_name - self.vnet_key = vnet_key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] self.address_prefixes = address_prefixes self.dev_setting_name = os.environ.get(dev_setting_name, None) - def create_resource(self, name, **kwargs): + def create_resource(self, name, **_): if self.dev_setting_name: return {self.parameter_name: self.dev_setting_name, } - if not self.resource_group_name: - self.resource_group_name = self.test_class_instance.kwargs.get( - self.resource_group_key) - if not self.resource_group_name: + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: raise CliTestError("Error: No resource group configured!") - if not self.vnet_name: - self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) - if not self.vnet_name: + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: raise CliTestError("Error: No vnet configured!") self.test_class_instance.kwargs[self.key] = 'default' return {self.parameter_name: name} - def remove_resource(self, name, **kwargs): + def remove_resource(self, name, **_): pass + + +class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.nic', + parameter_name='subnet', + resource_group_key=KEY_RESOURCE_GROUP, + vnet_key=KEY_VIRTUAL_NETWORK, + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME', + key=KEY_VNET_NIC): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetNicPreparer, self).__init__(name_prefix, 15) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group = [resource_group_key, None] + self.vnet = [vnet_key, None] + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **_): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group[1]: + self.resource_group[1] = self.test_class_instance.kwargs.get( + self.resource_group[0]) + if not self.resource_group[1]: + raise CliTestError("Error: No resource group configured!") + if not self.vnet[1]: + self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0]) + if not self.vnet[1]: + raise CliTestError("Error: No vnet configured!") + + template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default ' + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group[1], name, self.vnet[1])) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **_): + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, + 'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1])) diff --git a/src/hardware-security-modules/azext_hardware_security-modules/tests/latest/test_hardware-security-modules_scenario.py b/src/hardware-security-modules/azext_hardware_security_modules/tests/latest/test_hardware_security_modules_scenario.py similarity index 89% rename from src/hardware-security-modules/azext_hardware_security-modules/tests/latest/test_hardware-security-modules_scenario.py rename to src/hardware-security-modules/azext_hardware_security_modules/tests/latest/test_hardware_security_modules_scenario.py index 25503c1dcd0..a5b1420db26 100644 --- a/src/hardware-security-modules/azext_hardware_security-modules/tests/latest/test_hardware-security-modules_scenario.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/tests/latest/test_hardware_security_modules_scenario.py @@ -9,11 +9,8 @@ # -------------------------------------------------------------------------- import os -import unittest - -from azure_devtools.scenario_tests import AllowLargeResponse from azure.cli.testsdk import ScenarioTest -from .. import try_manual +from .. import try_manual, raise_if from azure.cli.testsdk import ResourceGroupPreparer from .preparers import VirtualNetworkPreparer @@ -36,13 +33,9 @@ def step__dedicatedhsm_put_create_a_new_or_update_an_existing_dedicated_hsm(test '--network-profile-subnet id="/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Net' 'work/virtualNetworks/{vn}/subnets/default" ' '--stamp-id "stamp01" ' - '--sku name="SafeNet Luna Network HSM A790" ' '--tags Dept="hsm" Environment="dogfood" ' '--resource-group "{rg}"', checks=[]) - test.cmd('az hardware-security-modules dedicated-hsm wait --created ' - '--resource-group "{rg}"', - checks=[]) # EXAMPLE: /DedicatedHsm/get/Get a dedicated HSM @@ -65,7 +58,8 @@ def step__dedicatedhsm_get_list_dedicated_hsm_devices_in_a_resource_group(test, # EXAMPLE: /DedicatedHsm/get/List dedicated HSM devices in a subscription @try_manual def step__dedicatedhsm_get_list_dedicated_hsm_devices_in_a_subscription(test, rg): - test.cmd('az hardware-security-modules dedicated-hsm list', + test.cmd('az hardware-security-modules dedicated-hsm list ' + '-g ""', checks=[]) @@ -119,3 +113,4 @@ def test_hardware_security_modules(self, rg): }) call_scenario(self, rg) + raise_if() diff --git a/src/hardware-security-modules/azext_hardware_security-modules/vendored_sdks/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/__init__.py similarity index 100% rename from src/hardware-security-modules/azext_hardware_security-modules/vendored_sdks/__init__.py rename to src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/__init__.py diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/__init__.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/__init__.py index da430e088ff..36b0f7850ad 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/__init__.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/__init__.py @@ -7,13 +7,10 @@ # -------------------------------------------------------------------------- from ._azure_dedicated_hsm_resource_provider import AzureDedicatedHSMResourceProvider -from ._version import VERSION - -__version__ = VERSION __all__ = ['AzureDedicatedHSMResourceProvider'] try: - from .patch import patch_sdk + from ._patch import patch_sdk patch_sdk() except ImportError: pass diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_azure_dedicated_hsm_resource_provider.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_azure_dedicated_hsm_resource_provider.py index 6e6efbe41b0..2daf331c153 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_azure_dedicated_hsm_resource_provider.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_azure_dedicated_hsm_resource_provider.py @@ -15,6 +15,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional + from azure.core.credentials import TokenCredential + from ._configuration import AzureDedicatedHSMResourceProviderConfiguration from .operations import OperationOperations from .operations import DedicatedHsmOperations @@ -25,14 +27,15 @@ class AzureDedicatedHSMResourceProvider(object): """The Azure management API provides a RESTful set of web services that interact with Azure Dedicated HSM RP. :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.hardwaresecuritymodules.operations.OperationOperations + :vartype operation: azure_dedicated_hsm_resource_provider.operations.OperationOperations :ivar dedicated_hsm: DedicatedHsmOperations operations - :vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.operations.DedicatedHsmOperations + :vartype dedicated_hsm: azure_dedicated_hsm_resource_provider.operations.DedicatedHsmOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_configuration.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_configuration.py index ac353d6ad2e..7f52c3ed7e1 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_configuration.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/_configuration.py @@ -11,14 +11,13 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from ._version import VERSION - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential +VERSION = "unknown" class AzureDedicatedHSMResourceProviderConfiguration(Configuration): """Configuration for AzureDedicatedHSMResourceProvider. @@ -49,7 +48,8 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-10-31-preview" self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-hardwaresecuritymodules/{}'.format(VERSION)) + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'azurededicatedhsmresourceprovider/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_azure_dedicated_hsm_resource_provider_async.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_azure_dedicated_hsm_resource_provider_async.py index bfb30d2a116..ca61f9719f4 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_azure_dedicated_hsm_resource_provider_async.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_azure_dedicated_hsm_resource_provider_async.py @@ -6,11 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + from ._configuration_async import AzureDedicatedHSMResourceProviderConfiguration from .operations_async import OperationOperations from .operations_async import DedicatedHsmOperations @@ -21,14 +25,15 @@ class AzureDedicatedHSMResourceProvider(object): """The Azure management API provides a RESTful set of web services that interact with Azure Dedicated HSM RP. :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.hardwaresecuritymodules.aio.operations_async.OperationOperations + :vartype operation: azure_dedicated_hsm_resource_provider.aio.operations_async.OperationOperations :ivar dedicated_hsm: DedicatedHsmOperations operations - :vartype dedicated_hsm: azure.mgmt.hardwaresecuritymodules.aio.operations_async.DedicatedHsmOperations + :vartype dedicated_hsm: azure_dedicated_hsm_resource_provider.aio.operations_async.DedicatedHsmOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_configuration_async.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_configuration_async.py index ec22f630e46..c0342acc8d6 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_configuration_async.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/_configuration_async.py @@ -11,12 +11,11 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from .._version import VERSION - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential + from azure.core.credentials_async import AsyncTokenCredential +VERSION = "unknown" class AzureDedicatedHSMResourceProviderConfiguration(Configuration): """Configuration for AzureDedicatedHSMResourceProvider. @@ -46,7 +45,8 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-10-31-preview" self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-hardwaresecuritymodules/{}'.format(VERSION)) + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'azurededicatedhsmresourceprovider/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_dedicated_hsm_operations_async.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_dedicated_hsm_operations_async.py index 3ac7d7ff6d5..84615f6e653 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_dedicated_hsm_operations_async.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_dedicated_hsm_operations_async.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,7 +28,7 @@ class DedicatedHsmOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hardwaresecuritymodules.models + :type models: ~azure_dedicated_hsm_resource_provider.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -53,18 +53,19 @@ async def _create_or_update_initial( tags: Optional[Dict[str, str]] = None, stamp_id: Optional[str] = None, subnet: Optional["models.ApiEntityReference"] = None, - network_interfaces: Optional[List["NetworkInterface"]] = None, + network_interfaces: Optional[List["models.NetworkInterface"]] = None, **kwargs ) -> "models.DedicatedHsm": cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) _parameters = models.DedicatedHsm(location=location, sku=sku, zones=zones, tags=tags, stamp_id=stamp_id, subnet=subnet, network_interfaces=network_interfaces) api_version = "2018-10-31-preview" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), @@ -103,10 +104,10 @@ async def _create_or_update_initial( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def create_or_update( self, @@ -118,7 +119,7 @@ async def create_or_update( tags: Optional[Dict[str, str]] = None, stamp_id: Optional[str] = None, subnet: Optional["models.ApiEntityReference"] = None, - network_interfaces: Optional[List["NetworkInterface"]] = None, + network_interfaces: Optional[List["models.NetworkInterface"]] = None, **kwargs ) -> "models.DedicatedHsm": """Create or Update a dedicated HSM in the specified subscription. @@ -130,7 +131,7 @@ async def create_or_update( :param location: The supported Azure location where the dedicated HSM should be created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: Resource tags. @@ -138,21 +139,25 @@ async def create_or_update( :param stamp_id: This field will be used when RP does not support Availability zones. :type stamp_id: str :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.hardwaresecuritymodules.models.ApiEntityReference + :type subnet: ~azure_dedicated_hsm_resource_provider.models.ApiEntityReference :param network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - :type network_interfaces: list[~azure.mgmt.hardwaresecuritymodules.models.NetworkInterface] + :type network_interfaces: list[~azure_dedicated_hsm_resource_provider.models.NetworkInterface] :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns DedicatedHsm - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: DedicatedHsm, or the result of cls(response) + :rtype: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsm :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, name=name, @@ -167,6 +172,9 @@ async def create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('DedicatedHsm', pipeline_response) @@ -174,15 +182,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def _update_initial( self, @@ -192,14 +196,15 @@ async def _update_initial( **kwargs ) -> "models.DedicatedHsm": cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) _parameters = models.DedicatedHsmPatchParameters(tags=tags) api_version = "2018-10-31-preview" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._update_initial.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), @@ -233,10 +238,10 @@ async def _update_initial( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def update( self, @@ -257,13 +262,17 @@ async def update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns DedicatedHsm - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: DedicatedHsm, or the result of cls(response) + :rtype: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsm :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._update_initial( resource_group_name=resource_group_name, name=name, @@ -272,6 +281,9 @@ async def update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('DedicatedHsm', pipeline_response) @@ -279,15 +291,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def _delete_initial( self, @@ -296,11 +304,12 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -326,9 +335,9 @@ async def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def delete( self, @@ -346,13 +355,17 @@ async def delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: None, or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, @@ -360,19 +373,18 @@ async def delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore async def get( self, @@ -387,16 +399,17 @@ async def get( :param name: The name of the dedicated HSM. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsm or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm + :return: DedicatedHsm, or the result of cls(response) + :rtype: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsm :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -425,17 +438,17 @@ async def get( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> "models.DedicatedHsmListResult": + ) -> AsyncIterable["models.DedicatedHsmListResult"]: """The List operation gets information about the dedicated hsms associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the dedicated HSM belongs. @@ -443,32 +456,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmListResult + :return: An iterator like instance of either DedicatedHsmListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -500,43 +514,44 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} # type: ignore def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> "models.DedicatedHsmListResult": + ) -> AsyncIterable["models.DedicatedHsmListResult"]: """The List operation gets information about the dedicated HSMs associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmListResult + :return: An iterator like instance of either DedicatedHsmListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -568,4 +583,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} # type: ignore diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_operation_operations_async.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_operation_operations_async.py index 4a04f0cff37..fd35858dd71 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_operation_operations_async.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/aio/operations_async/_operation_operations_async.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -26,7 +26,7 @@ class OperationOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hardwaresecuritymodules.models + :type models: ~azure_dedicated_hsm_resource_provider.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,29 +44,30 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "models.DedicatedHsmOperationListResult": + ) -> AsyncIterable["models.DedicatedHsmOperationListResult"]: """Get a list of Dedicated HSM operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmOperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperationListResult + :return: An iterator like instance of either DedicatedHsmOperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmOperationListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -98,4 +99,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.HardwareSecurityModules/operations'} + list.metadata = {'url': '/providers/Microsoft.HardwareSecurityModules/operations'} # type: ignore diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models.py index e852e416efd..3ea07197819 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models.py @@ -47,7 +47,7 @@ class Resource(msrest.serialization.Model): created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: A set of tags. Resource tags. @@ -102,7 +102,7 @@ class DedicatedHsm(Resource): created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: A set of tags. Resource tags. @@ -113,12 +113,13 @@ class DedicatedHsm(Resource): :vartype status_message: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.hardwaresecuritymodules.models.JsonWebKeyType + :vartype provisioning_state: str or + ~azure_dedicated_hsm_resource_provider.models.JsonWebKeyType :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.hardwaresecuritymodules.models.ApiEntityReference + :type subnet: ~azure_dedicated_hsm_resource_provider.models.ApiEntityReference :param network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - :type network_interfaces: list[~azure.mgmt.hardwaresecuritymodules.models.NetworkInterface] + :type network_interfaces: list[~azure_dedicated_hsm_resource_provider.models.NetworkInterface] """ _validation = { @@ -163,7 +164,7 @@ class DedicatedHsmError(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar error: The key vault server error. - :vartype error: ~azure.mgmt.hardwaresecuritymodules.models.Error + :vartype error: ~azure_dedicated_hsm_resource_provider.models.Error """ _validation = { @@ -186,7 +187,7 @@ class DedicatedHsmListResult(msrest.serialization.Model): """List of dedicated HSMs. :param value: The list of dedicated HSMs. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] + :type value: list[~azure_dedicated_hsm_resource_provider.models.DedicatedHsm] :param next_link: The URL to get the next set of dedicated hsms. :type next_link: str """ @@ -215,7 +216,7 @@ class DedicatedHsmOperation(msrest.serialization.Model): :ivar is_data_action: Gets or sets a value indicating whether it is a data plane action. :vartype is_data_action: str :param display: - :type display: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay + :type display: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperationDisplay """ _validation = { @@ -273,7 +274,7 @@ class DedicatedHsmOperationListResult(msrest.serialization.Model): """Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. :param value: List of Dedicated HSM Resource Provider operations. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperation] + :type value: list[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperation] """ _attribute_map = { @@ -317,7 +318,7 @@ class Error(msrest.serialization.Model): :ivar message: The error message. :vartype message: str :ivar inner_error: The key vault server error. - :vartype inner_error: ~azure.mgmt.hardwaresecuritymodules.models.Error + :vartype inner_error: ~azure_dedicated_hsm_resource_provider.models.Error """ _validation = { @@ -376,7 +377,7 @@ class ResourceListResult(msrest.serialization.Model): """List of dedicated HSM resources. :param value: The list of dedicated HSM resources. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.Resource] + :type value: list[~azure_dedicated_hsm_resource_provider.models.Resource] :param next_link: The URL to get the next set of dedicated HSM resources. :type next_link: str """ diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models_py3.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models_py3.py index 40ddae9ec3a..7496019f6a5 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models_py3.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/models/_models_py3.py @@ -51,7 +51,7 @@ class Resource(msrest.serialization.Model): created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: A set of tags. Resource tags. @@ -111,7 +111,7 @@ class DedicatedHsm(Resource): created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: A set of tags. Resource tags. @@ -122,12 +122,13 @@ class DedicatedHsm(Resource): :vartype status_message: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", "Provisioning", "Allocating", "Connecting", "Failed", "CheckingQuota", "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.hardwaresecuritymodules.models.JsonWebKeyType + :vartype provisioning_state: str or + ~azure_dedicated_hsm_resource_provider.models.JsonWebKeyType :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.hardwaresecuritymodules.models.ApiEntityReference + :type subnet: ~azure_dedicated_hsm_resource_provider.models.ApiEntityReference :param network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - :type network_interfaces: list[~azure.mgmt.hardwaresecuritymodules.models.NetworkInterface] + :type network_interfaces: list[~azure_dedicated_hsm_resource_provider.models.NetworkInterface] """ _validation = { @@ -180,7 +181,7 @@ class DedicatedHsmError(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar error: The key vault server error. - :vartype error: ~azure.mgmt.hardwaresecuritymodules.models.Error + :vartype error: ~azure_dedicated_hsm_resource_provider.models.Error """ _validation = { @@ -203,7 +204,7 @@ class DedicatedHsmListResult(msrest.serialization.Model): """List of dedicated HSMs. :param value: The list of dedicated HSMs. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] + :type value: list[~azure_dedicated_hsm_resource_provider.models.DedicatedHsm] :param next_link: The URL to get the next set of dedicated hsms. :type next_link: str """ @@ -235,7 +236,7 @@ class DedicatedHsmOperation(msrest.serialization.Model): :ivar is_data_action: Gets or sets a value indicating whether it is a data plane action. :vartype is_data_action: str :param display: - :type display: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay + :type display: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperationDisplay """ _validation = { @@ -301,7 +302,7 @@ class DedicatedHsmOperationListResult(msrest.serialization.Model): """Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. :param value: List of Dedicated HSM Resource Provider operations. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperation] + :type value: list[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperation] """ _attribute_map = { @@ -349,7 +350,7 @@ class Error(msrest.serialization.Model): :ivar message: The error message. :vartype message: str :ivar inner_error: The key vault server error. - :vartype inner_error: ~azure.mgmt.hardwaresecuritymodules.models.Error + :vartype inner_error: ~azure_dedicated_hsm_resource_provider.models.Error """ _validation = { @@ -410,7 +411,7 @@ class ResourceListResult(msrest.serialization.Model): """List of dedicated HSM resources. :param value: The list of dedicated HSM resources. - :type value: list[~azure.mgmt.hardwaresecuritymodules.models.Resource] + :type value: list[~azure_dedicated_hsm_resource_provider.models.Resource] :param next_link: The URL to get the next set of dedicated HSM resources. :type next_link: str """ diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_dedicated_hsm_operations.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_dedicated_hsm_operations.py index 1c5a682d161..a5f9a35e616 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_dedicated_hsm_operations.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_dedicated_hsm_operations.py @@ -20,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class DedicatedHsmOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hardwaresecuritymodules.models + :type models: ~azure_dedicated_hsm_resource_provider.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,19 +57,20 @@ def _create_or_update_initial( tags=None, # type: Optional[Dict[str, str]] stamp_id=None, # type: Optional[str] subnet=None, # type: Optional["models.ApiEntityReference"] - network_interfaces=None, # type: Optional[List["NetworkInterface"]] + network_interfaces=None, # type: Optional[List["models.NetworkInterface"]] **kwargs # type: Any ): # type: (...) -> "models.DedicatedHsm" cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) _parameters = models.DedicatedHsm(location=location, sku=sku, zones=zones, tags=tags, stamp_id=stamp_id, subnet=subnet, network_interfaces=network_interfaces) api_version = "2018-10-31-preview" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), @@ -108,10 +109,10 @@ def _create_or_update_initial( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def begin_create_or_update( self, @@ -123,10 +124,10 @@ def begin_create_or_update( tags=None, # type: Optional[Dict[str, str]] stamp_id=None, # type: Optional[str] subnet=None, # type: Optional["models.ApiEntityReference"] - network_interfaces=None, # type: Optional[List["NetworkInterface"]] + network_interfaces=None, # type: Optional[List["models.NetworkInterface"]] **kwargs # type: Any ): - # type: (...) -> "models.DedicatedHsm" + # type: (...) -> LROPoller """Create or Update a dedicated HSM in the specified subscription. :param resource_group_name: The name of the Resource Group to which the resource belongs. @@ -136,7 +137,7 @@ def begin_create_or_update( :param location: The supported Azure location where the dedicated HSM should be created. :type location: str :param sku: SKU details. - :type sku: ~azure.mgmt.hardwaresecuritymodules.models.Sku + :type sku: ~azure_dedicated_hsm_resource_provider.models.Sku :param zones: The Dedicated Hsm zones. :type zones: list[str] :param tags: Resource tags. @@ -144,21 +145,25 @@ def begin_create_or_update( :param stamp_id: This field will be used when RP does not support Availability zones. :type stamp_id: str :param subnet: Specifies the identifier of the subnet. - :type subnet: ~azure.mgmt.hardwaresecuritymodules.models.ApiEntityReference + :type subnet: ~azure_dedicated_hsm_resource_provider.models.ApiEntityReference :param network_interfaces: Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - :type network_interfaces: list[~azure.mgmt.hardwaresecuritymodules.models.NetworkInterface] + :type network_interfaces: list[~azure_dedicated_hsm_resource_provider.models.NetworkInterface] :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns DedicatedHsm - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DedicatedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_dedicated_hsm_resource_provider.models.DedicatedHsm] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, name=name, @@ -173,6 +178,9 @@ def begin_create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('DedicatedHsm', pipeline_response) @@ -180,15 +188,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def _update_initial( self, @@ -199,14 +203,15 @@ def _update_initial( ): # type: (...) -> "models.DedicatedHsm" cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) _parameters = models.DedicatedHsmPatchParameters(tags=tags) api_version = "2018-10-31-preview" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._update_initial.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), @@ -240,10 +245,10 @@ def _update_initial( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def begin_update( self, @@ -252,7 +257,7 @@ def begin_update( tags=None, # type: Optional[Dict[str, str]] **kwargs # type: Any ): - # type: (...) -> "models.DedicatedHsm" + # type: (...) -> LROPoller """Update a dedicated HSM in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -265,13 +270,17 @@ def begin_update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns DedicatedHsm - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DedicatedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_dedicated_hsm_resource_provider.models.DedicatedHsm] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._update_initial( resource_group_name=resource_group_name, name=name, @@ -280,6 +289,9 @@ def begin_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('DedicatedHsm', pipeline_response) @@ -287,15 +299,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def _delete_initial( self, @@ -305,11 +313,12 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -335,9 +344,9 @@ def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def begin_delete( self, @@ -345,7 +354,7 @@ def begin_delete( name, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller """Deletes the specified Azure Dedicated HSM. :param resource_group_name: The name of the Resource Group to which the dedicated HSM belongs. @@ -356,13 +365,17 @@ def begin_delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, @@ -370,19 +383,18 @@ def begin_delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def get( self, @@ -398,16 +410,17 @@ def get( :param name: The name of the dedicated HSM. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsm or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsm + :return: DedicatedHsm, or the result of cls(response) + :rtype: ~azure_dedicated_hsm_resource_provider.models.DedicatedHsm :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsm"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'name': self._serialize.url("name", name, 'str'), @@ -436,10 +449,10 @@ def get( deserialized = self._deserialize('DedicatedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}'} # type: ignore def list_by_resource_group( self, @@ -447,7 +460,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.DedicatedHsmListResult" + # type: (...) -> Iterable["models.DedicatedHsmListResult"] """The List operation gets information about the dedicated hsms associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the dedicated HSM belongs. @@ -455,32 +468,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmListResult + :return: An iterator like instance of either DedicatedHsmListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -512,44 +526,45 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} # type: ignore def list_by_subscription( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.DedicatedHsmListResult" + # type: (...) -> Iterable["models.DedicatedHsmListResult"] """The List operation gets information about the dedicated HSMs associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmListResult + :return: An iterator like instance of either DedicatedHsmListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -581,4 +596,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs'} # type: ignore diff --git a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_operation_operations.py b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_operation_operations.py index 9b325d2cba7..7336e0d22f2 100644 --- a/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_operation_operations.py +++ b/src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/_operation_operations.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -30,7 +30,7 @@ class OperationOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hardwaresecuritymodules.models + :type models: ~azure_dedicated_hsm_resource_provider.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,29 +49,30 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.DedicatedHsmOperationListResult" + # type: (...) -> Iterable["models.DedicatedHsmOperationListResult"] """Get a list of Dedicated HSM operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: DedicatedHsmOperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.hardwaresecuritymodules.models.DedicatedHsmOperationListResult + :return: An iterator like instance of either DedicatedHsmOperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_dedicated_hsm_resource_provider.models.DedicatedHsmOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DedicatedHsmOperationListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-10-31-preview" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -103,4 +104,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.HardwareSecurityModules/operations'} + list.metadata = {'url': '/providers/Microsoft.HardwareSecurityModules/operations'} # type: ignore diff --git a/src/hardware-security-modules/report.md b/src/hardware-security-modules/report.md index 03a076bba8d..59a6438d698 100644 --- a/src/hardware-security-modules/report.md +++ b/src/hardware-security-modules/report.md @@ -9,7 +9,6 @@ create a hardware-security-modules dedicated-hsm. |**--resource-group-name**|string|The name of the Resource Group to which the resource belongs.|resource_group_name| |**--name**|string|Name of the dedicated Hsm|name| |**--location**|string|The supported Azure location where the dedicated HSM should be created.|location| -|**--sku**|object|SKU details|sku| |**--zones**|array|The Dedicated Hsm zones.|zones| |**--tags**|dictionary|Resource tags|tags| |**--stamp-id**|string|This field will be used when RP does not support Availability zones.|stamp_id| diff --git a/src/hardware-security-modules/setup.py b/src/hardware-security-modules/setup.py index dd9010defa0..1cdbf819464 100644 --- a/src/hardware-security-modules/setup.py +++ b/src/hardware-security-modules/setup.py @@ -9,9 +9,12 @@ from codecs import open from setuptools import setup, find_packages -# TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. VERSION = '0.1.0' +try: + from .manual.version import VERSION +except ImportError: + pass # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -27,8 +30,11 @@ 'License :: OSI Approved :: MIT License', ] -# TODO: Add any additional SDK dependencies here DEPENDENCIES = [] +try: + from .manual.dependency import DEPENDENCIES +except ImportError: + pass with open('README.md', 'r', encoding='utf-8') as f: README = f.read() @@ -39,11 +45,9 @@ name='hardware_security_modules', version=VERSION, description='Microsoft Azure Command-Line Tools AzureDedicatedHSMResourceProvider Extension', - # TODO: Update author and email, if applicable author='Microsoft Corporation', author_email='azpycli@microsoft.com', - # TODO: consider pointing directly to your source code instead of the generic repo - url='https://github.com/Azure/azure-cli-extensions', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/hardware-security-modules', long_description=README + '\n\n' + HISTORY, license='MIT', classifiers=CLASSIFIERS,