diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6949a9723c3..22f73896447 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -98,4 +98,6 @@ /src/hpc-cache/ @qianwens +/src/import-export/ @arrownj + /src/account/ @zikalino diff --git a/src/import-export/HISTORY.rst b/src/import-export/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/import-export/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/import-export/README.md b/src/import-export/README.md new file mode 100644 index 00000000000..cafd6fbaa8c --- /dev/null +++ b/src/import-export/README.md @@ -0,0 +1,91 @@ +# Azure CLI import-export Extension # +This package is for the 'import-export' extension, i.e. 'az import-export'. + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name import-export +``` + +### Included Features +#### Import Export Management: +Manage Import Export: [more info](https://docs.microsoft.com/en-us/azure/storage/common/storage-import-export-service)\ +*Examples:* + +##### List locations to which you can ship the disks + +``` +az import-export location list +``` + +##### Show locations to which you can ship the disks + +``` +az import-export location show --location "West US" +``` + +##### Create an Import Job + +``` +az import-export create \ + --resource-group groupName \ + --name jobName \ + --location localtionName \ + --type Import \ + --log-level Verbose \ + --storage-account storageAccountID \ + --backup-drive-manifest true \ + --diagnostics-path waimportexport \ + --drive-list \ + drive-id=00000001 \ + bit-locker-key=000000-000000-000000-000000-000000-000000-000000-000000 \ + drive-header-hash="" \ + manifest-file=\\DriveManifest.xml \ + manifest-hash=109B21108597EF36D5785F08303F3638 \ + --return-address \ + city=Redmond \ + country-or-region=USA \ + email=Test@contoso.com \ + phone=4250000000 \ + postal-code=98007 \ + recipient-name=Tests \ + state-or-province=wa \ + street-address1=Street1 \ + street-address2=street2 +``` + +##### Update an Import Job + +``` +az import-export update \ + --resource-group groupName \ + --name jobName \ + --cancel-requested true +``` + +##### List Import Export Jobs + +``` +az import-export list \ + --resource-group groupName +``` + +##### Delete a Job + +``` +az import-export delete \ + --resource-group groupName \ + --name jobName +``` + +##### List bit locker keys of a Job + +``` +az import-export bit-locker-key list \ + --resource-group groupName \ + --job-name jobName +``` + + +If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues. + diff --git a/src/import-export/azext_import_export/__init__.py b/src/import-export/azext_import_export/__init__.py new file mode 100644 index 00000000000..3832f03c25c --- /dev/null +++ b/src/import-export/azext_import_export/__init__.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from .generated._help import helps # pylint: disable=unused-import + + +class ImportExportCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from .generated._client_factory import cf_import_export + import_export_custom = CliCommandType( + operations_tmpl='azext_import_export.custom#{}', + client_factory=cf_import_export) + super(ImportExportCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=import_export_custom) + + def load_command_table(self, args): + from .generated.commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from .generated._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = ImportExportCommandsLoader diff --git a/src/import-export/azext_import_export/action.py b/src/import-export/azext_import_export/action.py new file mode 100644 index 00000000000..d66d3c5d0d7 --- /dev/null +++ b/src/import-export/azext_import_export/action.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/import-export/azext_import_export/azext_metadata.json b/src/import-export/azext_import_export/azext_metadata.json new file mode 100644 index 00000000000..13025150393 --- /dev/null +++ b/src/import-export/azext_import_export/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/import-export/azext_import_export/commands.py b/src/import-export/azext_import_export/commands.py new file mode 100644 index 00000000000..42f0c1a991e --- /dev/null +++ b/src/import-export/azext_import_export/commands.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.commands import * # noqa: F403 +try: + from .manual.commands import * # noqa: F403 +except ImportError: + pass diff --git a/src/import-export/azext_import_export/custom.py b/src/import-export/azext_import_export/custom.py new file mode 100644 index 00000000000..d1fd3543ed0 --- /dev/null +++ b/src/import-export/azext_import_export/custom.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/import-export/azext_import_export/generated/_client_factory.py b/src/import-export/azext_import_export/generated/_client_factory.py new file mode 100644 index 00000000000..18f0b6e946b --- /dev/null +++ b/src/import-export/azext_import_export/generated/_client_factory.py @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def cf_import_export(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.storageimportexport import StorageImportExport + return get_mgmt_service_client(cli_ctx, StorageImportExport) + + +def cf_job(cli_ctx, *_): + return cf_import_export(cli_ctx).job + + +def cf_bit_locker_key(cli_ctx, *_): + return cf_import_export(cli_ctx).bit_locker_key + + +def cf_location(cli_ctx, *_): + return cf_import_export(cli_ctx).location diff --git a/src/import-export/azext_import_export/generated/_help.py b/src/import-export/azext_import_export/generated/_help.py new file mode 100644 index 00000000000..078bdb6eb31 --- /dev/null +++ b/src/import-export/azext_import_export/generated/_help.py @@ -0,0 +1,108 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['import-export'] = """ + type: group + short-summary: Manage Import Export +""" + +helps['import-export list'] = """ + type: command + short-summary: Returns all active and completed jobs in a subscription. + examples: + - name: List jobs in a resource group + text: |- + az import-export list --resource-group "myResourceGroup" + - name: List jobs in current subscription + text: |- + az import-export list +""" + +helps['import-export show'] = """ + type: command + short-summary: Gets information about an existing job. + examples: + - name: Get job + text: |- + az import-export show --resource-group "myResourceGroup" --name "myJob" +""" + +helps['import-export create'] = """ + type: command + short-summary: Creates a new job or updates an existing job in the specified subscription. + examples: + - name: Create an import job + text: |- + az import-export create --resource-group "myResourceGroup" --name "myJob" + --location "West US" --backup-drive-manifest true --diagnostics-path "waimportexport" + --drive-list bit-locker-key=238810-662376-448998-450120-652806-203390-606320-483076 + drive-header-hash= drive-id=9CA995BB manifest-file=\\\\DriveManifest.xml + manifest-hash=109B21108597EF36D5785F08303F3638 --type "Import" --log-level "Verbose" + --return-address city=Redmond country-or-region=USA email=Test@contoso.com phone=4250000000 + postal-code=98007 recipient-name=Tests state-or-province=wa street-address1=Street1 + street-address2=street2 --storage-account "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-\\ + xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test" +""" + +helps['import-export update'] = """ + type: command + short-summary: Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job. + examples: + - name: Update job + text: |- + az import-export update --resource-group "myResourceGroup" --name "myJob" + --backup-drive-manifest true --log-level "Verbose" --state "" +""" + +helps['import-export delete'] = """ + type: command + short-summary: Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + examples: + - name: Delete job + text: |- + az import-export delete --resource-group "myResourceGroup" --name "myJob" +""" + +helps['import-export bit-locker-key'] = """ + type: group + short-summary: import-export bit-locker-key +""" + +helps['import-export bit-locker-key list'] = """ + type: command + short-summary: Returns the BitLocker Keys for all drives in the specified job. + examples: + - name: List BitLocker Keys for drives in a job + text: |- + az import-export bit-locker-key list --resource-group "myResourceGroup" --job-name "myJob" +""" + +helps['import-export location'] = """ + type: group + short-summary: import-export location +""" + +helps['import-export location list'] = """ + type: command + short-summary: Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft data center region. + examples: + - name: List locations to which you can ship the disks + text: |- + az import-export location list +""" + +helps['import-export location show'] = """ + type: command + short-summary: Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region. + examples: + - name: Show details about a location + text: |- + az import-export location show --location "West US 2" +""" diff --git a/src/import-export/azext_import_export/generated/_params.py b/src/import-export/azext_import_export/generated/_params.py new file mode 100644 index 00000000000..42e8d0db3f1 --- /dev/null +++ b/src/import-export/azext_import_export/generated/_params.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + get_three_state_flag, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_import_export.action import ( + AddReturnAddress, + AddReturnShipping, + AddShippingInformation, + AddDeliveryPackage, + AddReturnPackage, + AddDriveList, + AddExport +) + + +def load_arguments(self, _): + + with self.argument_context('import-export list') as c: + pass + + with self.argument_context('import-export show') as c: + c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') + + with self.argument_context('import-export create') as c: + c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') + c.argument('client_tenant_id', help='The tenant ID of the client making the request.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('storage_account', help='Name or ID of the storage account where data will be imported to or exported from.') + c.argument('type', help='The type of job') + c.argument('return_address', action=AddReturnAddress, nargs='+', help='Specifies the return address information for the job.') + c.argument('return_shipping', action=AddReturnShipping, nargs='+', help='Specifies the return carrier and customer\'s account with the carrier.') + c.argument('shipping_information', action=AddShippingInformation, nargs='+', help='Contains information about the Microsoft datacenter to which the drives should be shipped.') + c.argument('delivery_package', action=AddDeliveryPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') + c.argument('return_package', action=AddReturnPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') + c.argument('diagnostics_path', help='The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.') + c.argument('log_level', help='Default value is Error. Indicates whether error logging or verbose logging will be enabled.') + c.argument('backup_drive_manifest', arg_type=get_three_state_flag(), help='Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.') + c.argument('state', help='Current state of the job.') + c.argument('cancel_requested', arg_type=get_three_state_flag(), help='Indicates whether a request has been submitted to cancel the job.') + c.argument('percent_complete', help='Overall percentage completed for the job.') + c.argument('incomplete_blob_list_uri', help='A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.') + c.argument('drive_list', action=AddDriveList, nargs='+', help='List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.') + c.argument('export', action=AddExport, nargs='+', help='A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs.') + + with self.argument_context('import-export update') as c: + c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') + c.argument('tags', tags_type) + c.argument('cancel_requested', arg_type=get_three_state_flag(), help='If specified, the value must be true. The service will attempt to cancel the job.') + c.argument('state', help='If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail.') + c.argument('return_address', action=AddReturnAddress, nargs='+', help='Specifies the return address information for the job.') + c.argument('return_shipping', action=AddReturnShipping, nargs='+', help='Specifies the return carrier and customer\'s account with the carrier.') + c.argument('delivery_package', action=AddDeliveryPackage, nargs='+', help='Contains information about the package being shipped by the customer to the Microsoft data center.') + c.argument('log_level', help='Indicates whether error logging or verbose logging is enabled.') + c.argument('backup_drive_manifest', arg_type=get_three_state_flag(), help='Indicates whether the manifest files on the drives should be copied to block blobs.') + c.argument('drive_list', action=AddDriveList, nargs='+', help='List of drives that comprise the job.') + + with self.argument_context('import-export delete') as c: + c.argument('name', options_list=['--name', '-n'], help='The name of the import/export job.') + + with self.argument_context('import-export bit-locker-key list') as c: + c.argument('job_name', help='The name of the import/export job.') + + with self.argument_context('import-export location show') as c: + c.argument('location', help='Location. Values from: `az import-export location list`.') diff --git a/src/import-export/azext_import_export/generated/_validators.py b/src/import-export/azext_import_export/generated/_validators.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/import-export/azext_import_export/generated/_validators.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/import-export/azext_import_export/generated/action.py b/src/import-export/azext_import_export/generated/action.py new file mode 100644 index 00000000000..7525687650f --- /dev/null +++ b/src/import-export/azext_import_export/generated/action.py @@ -0,0 +1,211 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError + + +class AddReturnAddress(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.return_address = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'recipient-name': + d['recipient_name'] = v + elif kl == 'street-address1': + d['street_address1'] = v + elif kl == 'street-address2': + d['street_address2'] = v + elif kl == 'city': + d['city'] = v + elif kl == 'state-or-province': + d['state_or_province'] = v + elif kl == 'postal-code': + d['postal_code'] = v + elif kl == 'country-or-region': + d['country_or_region'] = v + elif kl == 'phone': + d['phone'] = v + elif kl == 'email': + d['email'] = v + return d + + +class AddReturnShipping(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.return_shipping = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'carrier-name': + d['carrier_name'] = v + elif kl == 'carrier-account-number': + d['carrier_account_number'] = v + return d + + +class AddShippingInformation(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.shipping_information = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'recipient-name': + d['recipient_name'] = v + elif kl == 'street-address1': + d['street_address1'] = v + elif kl == 'street-address2': + d['street_address2'] = v + elif kl == 'city': + d['city'] = v + elif kl == 'state-or-province': + d['state_or_province'] = v + elif kl == 'postal-code': + d['postal_code'] = v + elif kl == 'country-or-region': + d['country_or_region'] = v + elif kl == 'phone': + d['phone'] = v + return d + + +class AddDeliveryPackage(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.delivery_package = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'carrier-name': + d['carrier_name'] = v + elif kl == 'tracking-number': + d['tracking_number'] = v + elif kl == 'drive-count': + d['drive_count'] = v + elif kl == 'ship-date': + d['ship_date'] = v + return d + + +class AddReturnPackage(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.return_package = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'carrier-name': + d['carrier_name'] = v + elif kl == 'tracking-number': + d['tracking_number'] = v + elif kl == 'drive-count': + d['drive_count'] = v + elif kl == 'ship-date': + d['ship_date'] = v + return d + + +class AddDriveList(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddDriveList, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'drive-id': + d['drive_id'] = v + elif kl == 'bit-locker-key': + d['bit_locker_key'] = v + elif kl == 'manifest-file': + d['manifest_file'] = v + elif kl == 'manifest-hash': + d['manifest_hash'] = v + elif kl == 'drive-header-hash': + d['drive_header_hash'] = v + elif kl == 'state': + d['state'] = v + elif kl == 'copy-status': + d['copy_status'] = v + elif kl == 'percent-complete': + d['percent_complete'] = v + elif kl == 'verbose-log-uri': + d['verbose_log_uri'] = v + elif kl == 'error-log-uri': + d['error_log_uri'] = v + elif kl == 'manifest-uri': + d['manifest_uri'] = v + elif kl == 'bytes-succeeded': + d['bytes_succeeded'] = v + return d + + +class AddExport(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.export = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = dict(x.split('=', 1) for x in values) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'blob-listblob-path': + d['blob_listblob_path'] = v + elif kl == 'blob-path': + d['blob_path'] = v + elif kl == 'blob-path-prefix': + d['blob_path_prefix'] = v + return d diff --git a/src/import-export/azext_import_export/generated/commands.py b/src/import-export/azext_import_export/generated/commands.py new file mode 100644 index 00000000000..69285b20201 --- /dev/null +++ b/src/import-export/azext_import_export/generated/commands.py @@ -0,0 +1,37 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_import_export.generated._client_factory import cf_job + import_export_job = CliCommandType( + operations_tmpl='azext_import_export.vendored_sdks.storageimportexport.operations._job_operations#JobOperations.{}', + client_factory=cf_job) + with self.command_group('import-export', import_export_job, client_factory=cf_job, is_experimental=True) as g: + g.custom_command('list', 'import_export_job_list') + g.custom_show_command('show', 'import_export_job_show') + g.custom_command('create', 'import_export_job_create') + g.custom_command('update', 'import_export_job_update') + g.custom_command('delete', 'import_export_job_delete') + + from azext_import_export.generated._client_factory import cf_bit_locker_key + import_export_bit_locker_key = CliCommandType( + operations_tmpl='azext_import_export.vendored_sdks.storageimportexport.operations._bit_locker_key_operations#BitLockerKeyOperations.{}', + client_factory=cf_bit_locker_key) + with self.command_group('import-export bit-locker-key', import_export_bit_locker_key, client_factory=cf_bit_locker_key) as g: + g.custom_command('list', 'import_export_bit_locker_key_list') + + from azext_import_export.generated._client_factory import cf_location + import_export_location = CliCommandType( + operations_tmpl='azext_import_export.vendored_sdks.storageimportexport.operations._location_operations#LocationOperations.{}', + client_factory=cf_location) + with self.command_group('import-export location', import_export_location, + client_factory=cf_location) as g: + g.custom_command('list', 'import_export_location_list') + g.custom_show_command('show', 'import_export_location_show') diff --git a/src/import-export/azext_import_export/generated/custom.py b/src/import-export/azext_import_export/generated/custom.py new file mode 100644 index 00000000000..4d9d1f23fe0 --- /dev/null +++ b/src/import-export/azext_import_export/generated/custom.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + + +def import_export_job_list(cmd, client, resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def import_export_job_show(cmd, client, name, resource_group_name): + return client.get(job_name=name, resource_group_name=resource_group_name) + + +def import_export_job_create(cmd, client, name, resource_group_name, client_tenant_id=None, location=None, tags=None, + storage_account=None, type=None, return_address=None, return_shipping=None, + shipping_information=None, delivery_package=None, + return_package=None, diagnostics_path=None, log_level=None, backup_drive_manifest=None, + state=None, cancel_requested=None, percent_complete=None, incomplete_blob_list_uri=None, + drive_list=None, export=None): + # pylint: disable=redefined-builtin + from msrestazure.tools import resource_id, is_valid_resource_id + from azure.cli.core.commands.client_factory import get_subscription_id + storage_account_id = storage_account + if not is_valid_resource_id(storage_account_id): + storage_account_id = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, + namespace='Microsoft.Storage', type='storageAccounts', name=storage_account) + + return client.create(job_name=name, resource_group_name=resource_group_name, client_tenant_id=client_tenant_id, + location=location, tags=tags, storage_account_id=storage_account_id, job_type=type, + return_address=return_address, return_shipping=return_shipping, + shipping_information=shipping_information, delivery_package=delivery_package, + return_package=return_package, diagnostics_path=diagnostics_path, log_level=log_level, + backup_drive_manifest=backup_drive_manifest, state=state, cancel_requested=cancel_requested, + percent_complete=percent_complete, incomplete_blob_list_uri=incomplete_blob_list_uri, + drive_list=drive_list, export=export) + + +def import_export_job_update(cmd, client, name, resource_group_name, tags=None, cancel_requested=None, state=None, + return_address=None, return_shipping=None, delivery_package=None, log_level=None, + backup_drive_manifest=None, drive_list=None): + return client.update(job_name=name, resource_group_name=resource_group_name, tags=tags, + cancel_requested=cancel_requested, state=state, return_address=return_address, + return_shipping=return_shipping, delivery_package=delivery_package, log_level=log_level, + backup_drive_manifest=backup_drive_manifest, drive_list=drive_list) + + +def import_export_job_delete(cmd, client, name, resource_group_name): + return client.delete(job_name=name, resource_group_name=resource_group_name) + + +def import_export_bit_locker_key_list(cmd, client, job_name, resource_group_name): + return client.list(job_name=job_name, resource_group_name=resource_group_name) + + +def import_export_location_list(cmd, client): + return client.list() + + +def import_export_location_show(cmd, client, location): + return client.get(location_name=location) diff --git a/src/import-export/azext_import_export/tests/latest/__init__.py b/src/import-export/azext_import_export/tests/latest/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/import-export/azext_import_export/tests/latest/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/import-export/azext_import_export/tests/latest/recordings/test_import_export.yaml b/src/import-export/azext_import_export/tests/latest/recordings/test_import_export.yaml new file mode 100644 index 00000000000..e0566cda5ee --- /dev/null +++ b/src/import-export/azext_import_export/tests/latest/recordings/test_import_export.yaml @@ -0,0 +1,749 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage account show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-storage/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002?api-version=2019-06-01 + response: + body: + string: '{"sku":{"name":"Standard_LRS","tier":"Standard"},"kind":"Storage","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002","name":"clitest000002","type":"Microsoft.Storage/storageAccounts","location":"westus","tags":{},"properties":{"privateEndpointConnections":[],"isHnsEnabled":false,"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2020-04-21T09:42:32.0887711Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2020-04-21T09:42:32.0887711Z"}},"keySource":"Microsoft.Storage"},"provisioningState":"Succeeded","creationTime":"2020-04-21T09:42:31.9950564Z","primaryEndpoints":{"blob":"https://clitest000002.blob.core.windows.net/","queue":"https://clitest000002.queue.core.windows.net/","table":"https://clitest000002.table.core.windows.net/","file":"https://clitest000002.file.core.windows.net/"},"primaryLocation":"westus","statusOfPrimary":"available"}}' + headers: + cache-control: + - no-cache + content-length: + - '1261' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:42:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export location list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: GET + uri: https://management.azure.com/providers/Microsoft.ImportExport/locations?api-version=2016-11-01 + response: + body: + string: "{\"value\":[{\"properties\":{\"recipientName\":\"This DC has security + requirements requiring advance notification for all inbound shipments. Contact + adbops@microsoft.com specifying your order name to receive the unique inbound + ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" \",\"city\":\" + \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" \",\"phone\":\" + \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiaeast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/australiaeast\",\"name\":\"Australia + East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This + DC has security requirements requiring advance notification for all inbound + shipments. Contact adbops@microsoft.com specifying your order name to receive + the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" + \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" + \",\"phone\":\" \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiasoutheast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/australiasoutheast\",\"name\":\"Australia + Southeast\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o AscentyRua + Papa Joao Paulo II 4 - Jardim Santa Izabel\",\"streetAddress2\":\"Hortol\xE2ndia\",\"city\":\"S\xE3o + Paulo\",\"stateOrProvince\":\"\",\"postalCode\":\"CEP: 13.185-252\",\"countryOrRegion\":\"Brazil\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/brazilsouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/brazilsouth\",\"name\":\"Brazil + South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o Allied Properties + REIT 35 John St\",\"streetAddress2\":\"\",\"city\":\"West Toronto\",\"stateOrProvince\":\"ON\",\"postalCode\":\"M5V + 3G6\",\"countryOrRegion\":\"Canada\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/canadacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/canadacentral\",\"name\":\"Canada + Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 4 Degrees + 2675 Boulevard du Parc-Technologique\",\"streetAddress2\":\"\",\"city\":\"Quebec + City\",\"stateOrProvince\":\"QC\",\"postalCode\":\"G1P 4S5\",\"countryOrRegion\":\"Canada\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/canadacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/canadaeast\",\"name\":\"Canada + East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Corp. (India) + Pvt. Ltd. c/o Tata Communications Ltd., IDC Building, 2nd floor, Alandi Road\",\"streetAddress2\":\"\",\"city\":\"Dighi, + Pune\",\"stateOrProvince\":\"Mahar\",\"postalCode\":\"411015\",\"countryOrRegion\":\"India\",\"phone\":\"+91-8956884068\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/centralindia\",\"name\":\"Central + India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"550 SE White Crane Rd\",\"streetAddress2\":\"\",\"city\":\"West + Des Moines\",\"stateOrProvince\":\"IA\",\"postalCode\":\"50265\",\"countryOrRegion\":\"USA\",\"phone\":\"5156975500\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/centralus\",\"name\":\"Central + US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"\\n Microsoft c/o + NTT Comm 6 Chun Kwong Street, Tseung Kwan O Industrial Estate \",\"streetAddress2\":\"\",\"city\":\"Tseung + Kwan O\",\"stateOrProvince\":\"\",\"postalCode\":\"\",\"countryOrRegion\":\"\",\"phone\":\"+852 + 3793 0508\\n \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastasia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastasia\",\"name\":\"East + Asia\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus\",\"name\":\"East + US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"101 Herbert Drive, BLDG + 7\",\"streetAddress2\":\"\",\"city\":\"Boydton\",\"stateOrProvince\":\"VA\",\"postalCode\":\"23917\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus2\",\"name\":\"East + US 2\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands + (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/germanynorth\",\"name\":\"Germany + North\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands + (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/germanywestcentral\",\"name\":\"Germany + West Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft C/O NTT Communications + 2-7-5, Tabatashinmachi, Kita-ku\",\"streetAddress2\":\"\",\"city\":\"Tokyo\",\"stateOrProvince\":\"\",\"postalCode\":\"114-0012\",\"countryOrRegion\":\"Japan\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/japaneast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/japaneast\",\"name\":\"Japan + East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft C/O NTT Communications3-1-21, + Dojima Kita-ku\",\"streetAddress2\":\"\",\"city\":\"Osaka City\",\"stateOrProvince\":\"Osaka\",\"postalCode\":\"553-0003\",\"countryOrRegion\":\"Japan\",\"phone\":\"+81 + (6) 7670-6655\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/japanwest\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/japanwest\",\"name\":\"Japan + West\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 29, Simindaero-327gil, + Dong An-gu\",\"streetAddress2\":\"Anyang-si\",\"city\":\"Kyeonggido\",\"stateOrProvince\":\"\",\"postalCode\":\"14055\",\"countryOrRegion\":\"Republic + of Korea\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/koreacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/koreacentral\",\"name\":\"Korea + Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 29, Simindaero-327gil, + Dong An-gu\",\"streetAddress2\":\"Anyang-si\",\"city\":\"Kyeonggido\",\"stateOrProvince\":\"\",\"postalCode\":\"14055\",\"countryOrRegion\":\"Republic + of Korea\",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiasoutheast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/koreasouth\",\"name\":\"Korea + South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"601 Northwest Ave.\",\"streetAddress2\":\"\",\"city\":\"Northlake\",\"stateOrProvince\":\"IL\",\"postalCode\":\"60164\",\"countryOrRegion\":\"USA\",\"phone\":\"(708) + 836-5143\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/northcentralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/northcentralus\",\"name\":\"North + Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Unit 74 Grange Castle Business + Park, Clondalkin\",\"streetAddress2\":\"\",\"city\":\"Dublin\",\"stateOrProvince\":\"\",\"postalCode\":\"22\",\"countryOrRegion\":\"Ireland + (IE)\",\"phone\":\"8886052200\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/northeurope\",\"name\":\"North + Europe\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"5150 Rogers Road\",\"streetAddress2\":\"\",\"city\":\"San + Antonio\",\"stateOrProvince\":\"TX\",\"postalCode\":\"78251\",\"countryOrRegion\":\"USA\",\"phone\":\"+1 + 210 3462528\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southcentralus\",\"name\":\"South + Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Corp. (India) + Pvt. Ltd. C/o Tata Communications Ltd, 226 Red Hills Road, Kallikuppam\",\"streetAddress2\":\"\",\"city\":\"Ambattur\",\"stateOrProvince\":\"Tamil + Nadu\",\"postalCode\":\"600053\",\"countryOrRegion\":\"India\",\"phone\":\"+91 + 7200090173\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/southindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southindia\",\"name\":\"South + India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"21 Defu Ave 1\",\"streetAddress2\":\"\",\"city\":\"Singapore\",\"stateOrProvince\":\"539539\",\"postalCode\":\"Singapore + (SG)\",\"countryOrRegion\":\"+659017 9066\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/southeastasia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southeastasia\",\"name\":\"Southeast + Asia\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This + DC has security requirements requiring advance notification for all inbound + shipments. Contact adbops@microsoft.com specifying your order name to receive + the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" + \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" + \",\"phone\":\" \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/uksouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/uksouth\",\"name\":\"UK + South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This + DC has security requirements requiring advance notification for all inbound + shipments. Contact adbops@microsoft.com specifying your order name to receive + the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" + \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" + \",\"phone\":\" \",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/uksouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/ukwest\",\"name\":\"UK + West\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft 638 Logistics + Drive\",\"streetAddress2\":\"\",\"city\":\"Cheyenne\",\"stateOrProvince\":\"WY\",\"postalCode\":\"82007\",\"countryOrRegion\":\"USA\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westcentralus\",\"name\":\"West + Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands + (NL)\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westeurope\",\"name\":\"West + Europe\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o Tata Communications,Tower + A , 6th Floor,Plot # C21 C36, Bandra Kurla Complex, Near MTNL\",\"streetAddress2\":\"\",\"city\":\"Mumbai\",\"stateOrProvince\":\"Maharashtra\",\"postalCode\":\"400098\",\"countryOrRegion\":\"India\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westindia\",\"name\":\"West + India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"3020 Coronado\",\"streetAddress2\":\"\",\"city\":\"Santa + Clara\",\"stateOrProvince\":\"CA\",\"postalCode\":\"95054\",\"countryOrRegion\":\"USA\",\"phone\":\"408 + 352 7600\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westus\",\"name\":\"West + US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft + Azure Import/Export Service\",\"streetAddress1\":\"1515 Port Industrial Parkway\",\"streetAddress2\":\"\",\"city\":\"Quincy\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98848\",\"countryOrRegion\":\"USA\",\"supportedCarriers\":[\"Blue + Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus2\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westus2\",\"name\":\"West + US 2\",\"type\":\"Microsoft.ImportExport/locations\"}]}" + headers: + cache-control: + - no-cache + content-length: + - '15120' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:42:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export location list + Connection: + - keep-alive + User-Agent: + - python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/locations?api-version=2019-06-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East + Asia","longitude":"114.188","latitude":"22.267"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia","name":"southeastasia","displayName":"Southeast + Asia","longitude":"103.833","latitude":"1.283"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus","name":"centralus","displayName":"Central + US","longitude":"-93.6208","latitude":"41.5908"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus","name":"eastus","displayName":"East + US","longitude":"-79.8164","latitude":"37.3719"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2","name":"eastus2","displayName":"East + US 2","longitude":"-78.3889","latitude":"36.6681"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus","name":"westus","displayName":"West + US","longitude":"-122.417","latitude":"37.783"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralus","name":"northcentralus","displayName":"North + Central US","longitude":"-87.6278","latitude":"41.8819"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralus","name":"southcentralus","displayName":"South + Central US","longitude":"-98.5","latitude":"29.4167"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northeurope","name":"northeurope","displayName":"North + Europe","longitude":"-6.2597","latitude":"53.3478"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westeurope","name":"westeurope","displayName":"West + Europe","longitude":"4.9","latitude":"52.3667"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japanwest","name":"japanwest","displayName":"Japan + West","longitude":"135.5022","latitude":"34.6939"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japaneast","name":"japaneast","displayName":"Japan + East","longitude":"139.77","latitude":"35.68"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilsouth","name":"brazilsouth","displayName":"Brazil + South","longitude":"-46.633","latitude":"-23.55"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiaeast","name":"australiaeast","displayName":"Australia + East","longitude":"151.2094","latitude":"-33.86"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiasoutheast","name":"australiasoutheast","displayName":"Australia + Southeast","longitude":"144.9631","latitude":"-37.8136"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southindia","name":"southindia","displayName":"South + India","longitude":"80.1636","latitude":"12.9822"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralindia","name":"centralindia","displayName":"Central + India","longitude":"73.9197","latitude":"18.5822"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westindia","name":"westindia","displayName":"West + India","longitude":"72.868","latitude":"19.088"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadacentral","name":"canadacentral","displayName":"Canada + Central","longitude":"-79.383","latitude":"43.653"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadaeast","name":"canadaeast","displayName":"Canada + East","longitude":"-71.217","latitude":"46.817"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uksouth","name":"uksouth","displayName":"UK + South","longitude":"-0.799","latitude":"50.941"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/ukwest","name":"ukwest","displayName":"UK + West","longitude":"-3.084","latitude":"53.427"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westcentralus","name":"westcentralus","displayName":"West + Central US","longitude":"-110.234","latitude":"40.890"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2","name":"westus2","displayName":"West + US 2","longitude":"-119.852","latitude":"47.233"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreacentral","name":"koreacentral","displayName":"Korea + Central","longitude":"126.9780","latitude":"37.5665"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth","name":"koreasouth","displayName":"Korea + South","longitude":"129.0756","latitude":"35.1796"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francecentral","name":"francecentral","displayName":"France + Central","longitude":"2.3730","latitude":"46.3772"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francesouth","name":"francesouth","displayName":"France + South","longitude":"2.1972","latitude":"43.8345"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral","name":"australiacentral","displayName":"Australia + Central","longitude":"149.1244","latitude":"-35.3075"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral2","name":"australiacentral2","displayName":"Australia + Central 2","longitude":"149.1244","latitude":"-35.3075"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaecentral","name":"uaecentral","displayName":"UAE + Central","longitude":"54.366669","latitude":"24.466667"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaenorth","name":"uaenorth","displayName":"UAE + North","longitude":"55.316666","latitude":"25.266666"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricanorth","name":"southafricanorth","displayName":"South + Africa North","longitude":"28.218370","latitude":"-25.731340"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricawest","name":"southafricawest","displayName":"South + Africa West","longitude":"18.843266","latitude":"-34.075691"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandnorth","name":"switzerlandnorth","displayName":"Switzerland + North","longitude":"8.564572","latitude":"47.451542"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandwest","name":"switzerlandwest","displayName":"Switzerland + West","longitude":"6.143158","latitude":"46.204391"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanynorth","name":"germanynorth","displayName":"Germany + North","longitude":"8.806422","latitude":"53.073635"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanywestcentral","name":"germanywestcentral","displayName":"Germany + West Central","longitude":"8.682127","latitude":"50.110924"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwaywest","name":"norwaywest","displayName":"Norway + West","longitude":"5.733107","latitude":"58.969975"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwayeast","name":"norwayeast","displayName":"Norway + East","longitude":"10.752245","latitude":"59.913868"}]}' + headers: + cache-control: + - no-cache + content-length: + - '7129' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 21 Apr 2020 09:42:55 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export location show + Connection: + - keep-alive + ParameterSetName: + - --location + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: GET + uri: https://management.azure.com/providers/Microsoft.ImportExport/locations/westus2?api-version=2016-11-01 + response: + body: + string: '{"properties":{"recipientName":"Microsoft Azure Import/Export Service","streetAddress1":"1515 + Port Industrial Parkway","streetAddress2":"","city":"Quincy","stateOrProvince":"WA","postalCode":"98848","countryOrRegion":"USA","supportedCarriers":["Blue + Dart","DHL","FedEx","TNT","UPS"],"alternateLocations":["/providers/Microsoft.ImportExport/locations/westus2"]},"id":"/providers/Microsoft.ImportExport/locations/westus2","name":"West + US 2","type":"Microsoft.ImportExport/locations"}' + headers: + cache-control: + - no-cache + content-length: + - '481' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:42:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export location show + Connection: + - keep-alive + ParameterSetName: + - --location + User-Agent: + - python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/locations?api-version=2019-06-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastasia","name":"eastasia","displayName":"East + Asia","longitude":"114.188","latitude":"22.267"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southeastasia","name":"southeastasia","displayName":"Southeast + Asia","longitude":"103.833","latitude":"1.283"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralus","name":"centralus","displayName":"Central + US","longitude":"-93.6208","latitude":"41.5908"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus","name":"eastus","displayName":"East + US","longitude":"-79.8164","latitude":"37.3719"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/eastus2","name":"eastus2","displayName":"East + US 2","longitude":"-78.3889","latitude":"36.6681"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus","name":"westus","displayName":"West + US","longitude":"-122.417","latitude":"37.783"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northcentralus","name":"northcentralus","displayName":"North + Central US","longitude":"-87.6278","latitude":"41.8819"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southcentralus","name":"southcentralus","displayName":"South + Central US","longitude":"-98.5","latitude":"29.4167"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/northeurope","name":"northeurope","displayName":"North + Europe","longitude":"-6.2597","latitude":"53.3478"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westeurope","name":"westeurope","displayName":"West + Europe","longitude":"4.9","latitude":"52.3667"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japanwest","name":"japanwest","displayName":"Japan + West","longitude":"135.5022","latitude":"34.6939"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/japaneast","name":"japaneast","displayName":"Japan + East","longitude":"139.77","latitude":"35.68"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/brazilsouth","name":"brazilsouth","displayName":"Brazil + South","longitude":"-46.633","latitude":"-23.55"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiaeast","name":"australiaeast","displayName":"Australia + East","longitude":"151.2094","latitude":"-33.86"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiasoutheast","name":"australiasoutheast","displayName":"Australia + Southeast","longitude":"144.9631","latitude":"-37.8136"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southindia","name":"southindia","displayName":"South + India","longitude":"80.1636","latitude":"12.9822"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/centralindia","name":"centralindia","displayName":"Central + India","longitude":"73.9197","latitude":"18.5822"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westindia","name":"westindia","displayName":"West + India","longitude":"72.868","latitude":"19.088"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadacentral","name":"canadacentral","displayName":"Canada + Central","longitude":"-79.383","latitude":"43.653"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/canadaeast","name":"canadaeast","displayName":"Canada + East","longitude":"-71.217","latitude":"46.817"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uksouth","name":"uksouth","displayName":"UK + South","longitude":"-0.799","latitude":"50.941"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/ukwest","name":"ukwest","displayName":"UK + West","longitude":"-3.084","latitude":"53.427"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westcentralus","name":"westcentralus","displayName":"West + Central US","longitude":"-110.234","latitude":"40.890"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus2","name":"westus2","displayName":"West + US 2","longitude":"-119.852","latitude":"47.233"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreacentral","name":"koreacentral","displayName":"Korea + Central","longitude":"126.9780","latitude":"37.5665"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/koreasouth","name":"koreasouth","displayName":"Korea + South","longitude":"129.0756","latitude":"35.1796"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francecentral","name":"francecentral","displayName":"France + Central","longitude":"2.3730","latitude":"46.3772"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/francesouth","name":"francesouth","displayName":"France + South","longitude":"2.1972","latitude":"43.8345"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral","name":"australiacentral","displayName":"Australia + Central","longitude":"149.1244","latitude":"-35.3075"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/australiacentral2","name":"australiacentral2","displayName":"Australia + Central 2","longitude":"149.1244","latitude":"-35.3075"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaecentral","name":"uaecentral","displayName":"UAE + Central","longitude":"54.366669","latitude":"24.466667"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/uaenorth","name":"uaenorth","displayName":"UAE + North","longitude":"55.316666","latitude":"25.266666"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricanorth","name":"southafricanorth","displayName":"South + Africa North","longitude":"28.218370","latitude":"-25.731340"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/southafricawest","name":"southafricawest","displayName":"South + Africa West","longitude":"18.843266","latitude":"-34.075691"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandnorth","name":"switzerlandnorth","displayName":"Switzerland + North","longitude":"8.564572","latitude":"47.451542"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/switzerlandwest","name":"switzerlandwest","displayName":"Switzerland + West","longitude":"6.143158","latitude":"46.204391"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanynorth","name":"germanynorth","displayName":"Germany + North","longitude":"8.806422","latitude":"53.073635"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/germanywestcentral","name":"germanywestcentral","displayName":"Germany + West Central","longitude":"8.682127","latitude":"50.110924"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwaywest","name":"norwaywest","displayName":"Norway + West","longitude":"5.733107","latitude":"58.969975"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/locations/norwayeast","name":"norwayeast","displayName":"Norway + East","longitude":"10.752245","latitude":"59.913868"}]}' + headers: + cache-control: + - no-cache + content-length: + - '7129' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 21 Apr 2020 09:42:57 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: 'b''b\''{"location": "westus", "properties": {"storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002", + "jobType": "Import", "returnAddress": {"recipientName": "Tests", "streetAddress1": + "Street1", "streetAddress2": "street2", "city": "Redmond", "stateOrProvince": + "wa", "postalCode": "98007", "countryOrRegion": "USA", "phone": "4250000000", + "email": "Test@contoso.com"}, "diagnosticsPath": "waimportexport", "logLevel": + "Verbose", "backupDriveManifest": true, "driveList": [{"driveId": "9CA995BF", + "bitLockerKey": "238810-662376-448998-450120-652806-203390-606320-483076", "manifestFile": + "\\\\\\\\DriveManifest.xml", "manifestHash": "109B21108597EF36D5785F08303F3638", + "driveHeaderHash": ""}]}}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export create + Connection: + - keep-alive + Content-Length: + - '860' + Content-Type: + - application/json + ParameterSetName: + - -g -n --location --type --log-level --storage-account --backup-drive-manifest + --diagnostics-path --drive-list --return-address + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002","jobType":"Import","returnAddress":{"recipientName":"Tests","streetAddress1":"Street1","streetAddress2":"street2","city":"Redmond","stateOrProvince":"wa","postalCode":"98007","countryOrRegion":"USA","phone":"4250000000","email":"Test@contoso.com"},"shippingInformation":{"recipientName":"Microsoft + Azure Import/Export Service","streetAddress1":"3020 Coronado","streetAddress2":"","city":"Santa + Clara","stateOrProvince":"CA","postalCode":"95054","countryOrRegion":"USA","phone":"408 + 352 7600"},"diagnosticsPath":"waimportexport","logLevel":"Verbose","backupDriveManifest":true,"cancelRequested":false,"state":"Creating","driveList":[{"driveId":"9CA995BF","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003","name":"test-import-export-000003","type":"Microsoft.ImportExport/jobs","location":"westus"}' + headers: + cache-control: + - no-cache + content-length: + - '1443' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:43:06 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs?api-version=2016-11-01 + response: + body: + string: '{"value":[{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002","jobType":"Import","returnAddress":{"recipientName":"Tests","streetAddress1":"Street1","streetAddress2":"street2","city":"Redmond","stateOrProvince":"wa","postalCode":"98007","countryOrRegion":"USA","phone":"4250000000","email":"Test@contoso.com"},"shippingInformation":{"recipientName":"Microsoft + Azure Import/Export Service","streetAddress1":"3020 Coronado","streetAddress2":"","city":"Santa + Clara","stateOrProvince":"CA","postalCode":"95054","countryOrRegion":"USA","phone":"408 + 352 7600"},"diagnosticsPath":"waimportexport","logLevel":"Verbose","backupDriveManifest":true,"cancelRequested":false,"state":"Creating","provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003","name":"test-import-export-000003","type":"Microsoft.ImportExport/jobs","location":"West + US"}]}' + headers: + cache-control: + - no-cache + content-length: + - '1291' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:43:08 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002","jobType":"Import","returnAddress":{"recipientName":"Tests","streetAddress1":"Street1","streetAddress2":"street2","city":"Redmond","stateOrProvince":"wa","postalCode":"98007","countryOrRegion":"USA","phone":"4250000000","email":"Test@contoso.com"},"shippingInformation":{"recipientName":"Microsoft + Azure Import/Export Service","streetAddress1":"3020 Coronado","streetAddress2":"","city":"Santa + Clara","stateOrProvince":"CA","postalCode":"95054","countryOrRegion":"USA","phone":"408 + 352 7600"},"diagnosticsPath":"waimportexport","logLevel":"Verbose","backupDriveManifest":true,"cancelRequested":false,"state":"Creating","driveList":[{"driveId":"9CA995BF","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003","name":"test-import-export-000003","type":"Microsoft.ImportExport/jobs","location":"West + US"}' + headers: + cache-control: + - no-cache + content-length: + - '1444' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:43:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"properties": {"cancelRequested": true}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export update + Connection: + - keep-alive + Content-Length: + - '41' + Content-Type: + - application/json + ParameterSetName: + - -g -n --cancel-requested + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.Storage/storageAccounts/clitest000002","jobType":"Import","returnAddress":{"recipientName":"Tests","streetAddress1":"Street1","streetAddress2":"street2","city":"Redmond","stateOrProvince":"wa","postalCode":"98007","countryOrRegion":"USA","phone":"4250000000","email":"Test@contoso.com"},"shippingInformation":{"recipientName":"Microsoft + Azure Import/Export Service","streetAddress1":"3020 Coronado","streetAddress2":"","city":"Santa + Clara","stateOrProvince":"CA","postalCode":"95054","countryOrRegion":"USA","phone":"408 + 352 7600"},"diagnosticsPath":"waimportexport","logLevel":"Verbose","backupDriveManifest":true,"cancelRequested":true,"state":"Creating","driveList":[{"driveId":"9CA995BF","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003","name":"test-import-export-000003","type":"Microsoft.ImportExport/jobs","location":"West + US"}' + headers: + cache-control: + - no-cache + content-length: + - '1443' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:43:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export bit-locker-key list + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --job-name + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003/listBitLockerKeys?api-version=2016-11-01 + response: + body: + string: '{"value":[{"driveId":"9CA995BF","bitLockerKey":"238810-662376-448998-450120-652806-203390-606320-483076"}]}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: + - application/json + date: + - Tue, 21 Apr 2020 09:43:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - import-export delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -n + User-Agent: + - AZURECLI/2.4.0 azsdk-python-core/1.4.0 Python/3.8.2 (Windows-10-10.0.18362-SP0) + azsdk-python-storageimportexport/unknown + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_import_export_000001/providers/Microsoft.ImportExport/jobs/test-import-export-000003?api-version=2016-11-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 21 Apr 2020 09:43:20 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK +version: 1 diff --git a/src/import-export/azext_import_export/tests/latest/test_import_export_scenario.py b/src/import-export/azext_import_export/tests/latest/test_import_export_scenario.py new file mode 100644 index 00000000000..be675899654 --- /dev/null +++ b/src/import-export/azext_import_export/tests/latest/test_import_export_scenario.py @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os + +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, StorageAccountPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +class ImportExportScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='cli_test_import_export_', key='rg') + @StorageAccountPreparer(parameter_name='storage_account') + def test_import_export(self, resource_group, storage_account): + self.kwargs.update({ + 'job_name': self.create_random_name(prefix='test-import-export-', length=24), + 'storage_account': storage_account, + 'bit_locker_key': '238810-662376-448998-450120-652806-203390-606320-483076', + 'driver_id': '9CA995BF' + }) + storage_account_id = self.cmd('storage account show -g {rg} -n {storage_account}').get_output_in_json()['id'] + self.kwargs.update({ + 'storage_account_id': storage_account_id + }) + + self.cmd('import-export location list', checks=[ + self.greater_than('length(@)', 0) + ]) + self.cmd('import-export location show --location "West US 2"', checks=[ + self.check('name', 'West US 2') + ]) + + self.cmd('import-export create -g {rg} -n {job_name} --location "West US" --type Import --log-level Verbose ' + '--storage-account {storage_account_id} --backup-drive-manifest true ' + '--diagnostics-path waimportexport --drive-list drive-id={driver_id} bit-locker-key={bit_locker_key} ' + 'drive-header-hash="" manifest-file=\\\\DriveManifest.xml ' + 'manifest-hash=109B21108597EF36D5785F08303F3638 --return-address city=Redmond country-or-region=USA ' + 'email=Test@contoso.com phone=4250000000 postal-code=98007 recipient-name=Tests state-or-province=wa ' + 'street-address1=Street1 street-address2=street2', + checks=[self.check('name', '{job_name}')]) + self.cmd('import-export list -g {rg}', checks=[self.check('length(@)', 1)]) + self.cmd('import-export show -g {rg} -n {job_name}', checks=[self.check('name', '{job_name}')]) + self.cmd('import-export update -g {rg} -n {job_name} --cancel-requested true', checks=[ + self.check('name', '{job_name}'), + self.check('properties.cancelRequested', 'True') + ]) + + self.cmd('import-export bit-locker-key list -g {rg} --job-name {job_name}', checks=[ + self.check('[0].driveId', '{driver_id}'), + self.check('[0].bitLockerKey', '{bit_locker_key}') + ]) + self.cmd('import-export delete -g {rg} -n {job_name}') diff --git a/src/import-export/azext_import_export/vendored_sdks/__init__.py b/src/import-export/azext_import_export/vendored_sdks/__init__.py new file mode 100644 index 00000000000..be1a152630c --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/__init__.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/__init__.py new file mode 100644 index 00000000000..9dacfa50491 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/__init__.py @@ -0,0 +1,10 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._storage_import_export import StorageImportExport +__all__ = ['StorageImportExport'] diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_configuration.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_configuration.py new file mode 100644 index 00000000000..54d3fa539f8 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_configuration.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class StorageImportExportConfiguration(Configuration): + """Configuration for StorageImportExport + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param acceptlanguage: Specifies the preferred language for the response. + :type acceptlanguage: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + acceptlanguage=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(StorageImportExportConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.acceptlanguage = acceptlanguage + self.api_version = "2016-11-01" + self._configure(**kwargs) + self.user_agent_policy.add_user_agent('azsdk-python-storageimportexport/{}'.format(VERSION)) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, **kwargs) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_storage_import_export.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_storage_import_export.py new file mode 100644 index 00000000000..8f210f8ac8f --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/_storage_import_export.py @@ -0,0 +1,80 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +from ._configuration import StorageImportExportConfiguration +from .operations import LocationOperations +from .operations import JobOperations +from .operations import BitLockerKeyOperations +from .operations import OperationOperations +from . import models + + +class StorageImportExport(object): + """The Storage Import/Export Resource Provider API. + + :ivar location: LocationOperations operations + :vartype location: storage_import_export.operations.LocationOperations + :ivar job: JobOperations operations + :vartype job: storage_import_export.operations.JobOperations + :ivar bit_locker_key: BitLockerKeyOperations operations + :vartype bit_locker_key: storage_import_export.operations.BitLockerKeyOperations + :ivar operation: OperationOperations operations + :vartype operation: storage_import_export.operations.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param acceptlanguage: Specifies the preferred language for the response. + :type acceptlanguage: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + acceptlanguage=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = StorageImportExportConfiguration(credential, subscription_id, acceptlanguage, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.location = LocationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bit_locker_key = BitLockerKeyOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> StorageImportExport + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/__init__.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/__init__.py new file mode 100644 index 00000000000..56cd3f49059 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._storage_import_export_async import StorageImportExport +__all__ = ['StorageImportExport'] diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_configuration_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_configuration_async.py new file mode 100644 index 00000000000..fbab0f10c30 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_configuration_async.py @@ -0,0 +1,62 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class StorageImportExportConfiguration(Configuration): + """Configuration for StorageImportExport + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param acceptlanguage: Specifies the preferred language for the response. + :type acceptlanguage: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + acceptlanguage: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(StorageImportExportConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.acceptlanguage = acceptlanguage + self.api_version = "2016-11-01" + self._configure(**kwargs) + self.user_agent_policy.add_user_agent('azsdk-python-storageimportexport/{}'.format(VERSION)) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, **kwargs) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_storage_import_export_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_storage_import_export_async.py new file mode 100644 index 00000000000..1ecbc055dc1 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/_storage_import_export_async.py @@ -0,0 +1,76 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.core import AsyncPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import StorageImportExportConfiguration +from .operations_async import LocationOperations +from .operations_async import JobOperations +from .operations_async import BitLockerKeyOperations +from .operations_async import OperationOperations +from .. import models + + +class StorageImportExport(object): + """The Storage Import/Export Resource Provider API. + + :ivar location: LocationOperations operations + :vartype location: storage_import_export.aio.operations_async.LocationOperations + :ivar job: JobOperations operations + :vartype job: storage_import_export.aio.operations_async.JobOperations + :ivar bit_locker_key: BitLockerKeyOperations operations + :vartype bit_locker_key: storage_import_export.aio.operations_async.BitLockerKeyOperations + :ivar operation: OperationOperations operations + :vartype operation: storage_import_export.aio.operations_async.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param acceptlanguage: Specifies the preferred language for the response. + :type acceptlanguage: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + acceptlanguage: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = StorageImportExportConfiguration(credential, subscription_id, acceptlanguage, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.location = LocationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.job = JobOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bit_locker_key = BitLockerKeyOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "StorageImportExport": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/__init__.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/__init__.py new file mode 100644 index 00000000000..dcd0228be5a --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/__init__.py @@ -0,0 +1,19 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._location_operations_async import LocationOperations +from ._job_operations_async import JobOperations +from ._bit_locker_key_operations_async import BitLockerKeyOperations +from ._operation_operations_async import OperationOperations + +__all__ = [ + 'LocationOperations', + 'JobOperations', + 'BitLockerKeyOperations', + 'OperationOperations', +] diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_bit_locker_key_operations_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_bit_locker_key_operations_async.py new file mode 100644 index 00000000000..fbd966d7f0c --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_bit_locker_key_operations_async.py @@ -0,0 +1,113 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BitLockerKeyOperations: + """BitLockerKeyOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + job_name: str, + resource_group_name: str, + **kwargs + ) -> "models.GetBitLockerKeysResponse": + """Returns the BitLocker Keys for all drives in the specified job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetBitLockerKeysResponse or the result of cls(response) + :rtype: ~storage_import_export.models.GetBitLockerKeysResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.GetBitLockerKeysResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GetBitLockerKeysResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_job_operations_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_job_operations_async.py new file mode 100644 index 00000000000..890b3908ab6 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_job_operations_async.py @@ -0,0 +1,546 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class JobOperations: + """JobOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + top: Optional[int] = None, + filter: Optional[str] = None, + **kwargs + ) -> "models.ListJobsResponse": + """Returns all active and completed jobs in a subscription. + + :param top: An integer value that specifies how many jobs at most should be returned. The value + cannot exceed 100. + :type top: int + :param filter: Can be used to restrict the results to certain conditions. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListJobsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListJobsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.ListJobsResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListJobsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'} + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + filter: Optional[str] = None, + **kwargs + ) -> "models.ListJobsResponse": + """Returns all active and completed jobs in a resource group. + + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param top: An integer value that specifies how many jobs at most should be returned. The value + cannot exceed 100. + :type top: int + :param filter: Can be used to restrict the results to certain conditions. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListJobsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListJobsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.ListJobsResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListJobsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs'} + + async def get( + self, + job_name: str, + resource_group_name: str, + **kwargs + ) -> "models.JobResponse": + """Gets information about an existing job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.JobResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + async def update( + self, + job_name: str, + resource_group_name: str, + tags: Optional["models.UpdateJobParametersTags"] = None, + cancel_requested: Optional[bool] = None, + state: Optional[str] = None, + return_address: Optional["models.ReturnAddress"] = None, + return_shipping: Optional["models.ReturnShipping"] = None, + delivery_package: Optional["models.PackageInfomation"] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + drive_list: Optional[List["DriveStatus"]] = None, + **kwargs + ) -> "models.JobResponse": + """Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param tags: Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.UpdateJobParametersTags + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.JobResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + + body = models.UpdateJobParameters(tags=tags, cancel_requested=cancel_requested, state=state, return_address=return_address, return_shipping=return_shipping, delivery_package=delivery_package, log_level=log_level, backup_drive_manifest=backup_drive_manifest, drive_list=drive_list) + api_version = "2016-11-01" + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(body, 'UpdateJobParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + async def create( + self, + job_name: str, + resource_group_name: str, + client_tenant_id: Optional[str] = None, + location: Optional[str] = None, + tags: Optional["models.PutJobParametersTags"] = None, + storage_account_id: Optional[str] = None, + job_type: Optional[str] = None, + return_address: Optional["models.ReturnAddress"] = None, + return_shipping: Optional["models.ReturnShipping"] = None, + shipping_information: Optional["models.ShippingInformation"] = None, + delivery_package: Optional["models.PackageInfomation"] = None, + return_package: Optional["models.PackageInfomation"] = None, + diagnostics_path: Optional[str] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + state: Optional[str] = None, + cancel_requested: Optional[bool] = None, + percent_complete: Optional[int] = None, + incomplete_blob_list_uri: Optional[str] = None, + drive_list: Optional[List["DriveStatus"]] = None, + export: Optional["models.Export"] = None, + provisioning_state: Optional[str] = None, + **kwargs + ) -> "models.JobResponse": + """Creates a new job or updates an existing job in the specified subscription. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param client_tenant_id: The tenant ID of the client making the request. + :type client_tenant_id: str + :param location: Specifies the supported Azure location where the job should be created. + :type location: str + :param tags: Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.PutJobParametersTags + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse or ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.JobResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + + body = models.PutJobParameters(location=location, tags=tags, storage_account_id=storage_account_id, job_type=job_type, return_address=return_address, return_shipping=return_shipping, shipping_information=shipping_information, delivery_package=delivery_package, return_package=return_package, diagnostics_path=diagnostics_path, log_level=log_level, backup_drive_manifest=backup_drive_manifest, state=state, cancel_requested=cancel_requested, percent_complete=percent_complete, incomplete_blob_list_uri=incomplete_blob_list_uri, drive_list=drive_list, export=export, provisioning_state=provisioning_state) + api_version = "2016-11-01" + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + if client_tenant_id is not None: + header_parameters['x-ms-client-tenant-id'] = self._serialize.header("client_tenant_id", client_tenant_id, 'str') + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(body, 'PutJobParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('JobResponse', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + async def delete( + self, + job_name: str, + resource_group_name: str, + **kwargs + ) -> None: + """Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType[None] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_location_operations_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_location_operations_async.py new file mode 100644 index 00000000000..26e0ecd3617 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_location_operations_async.py @@ -0,0 +1,152 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LocationOperations: + """LocationOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> "models.LocationsResponse": + """Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft data center region. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocationsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.LocationsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.LocationsResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LocationsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ImportExport/locations'} + + async def get( + self, + location_name: str, + **kwargs + ) -> "models.Location": + """Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region. + + :param location_name: The name of the location. For example, West US or westus. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Location or the result of cls(response) + :rtype: ~storage_import_export.models.Location + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.Location"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('Location', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.ImportExport/locations/{locationName}'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_operation_operations_async.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..41528257a21 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,100 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> "models.ListOperationsResponse": + """Returns the list of operations supported by the import/export resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListOperationsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListOperationsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls: ClsType["models.ListOperationsResponse"] = kwargs.pop('cls', None ) + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters: Dict[str, Any] = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters: Dict[str, Any] = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListOperationsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ImportExport/operations'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/__init__.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/__init__.py new file mode 100644 index 00000000000..84af98470af --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/__init__.py @@ -0,0 +1,101 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import DriveBitLockerKey + from ._models_py3 import DriveStatus + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseError + from ._models_py3 import ErrorResponseErrorDetailsItem + from ._models_py3 import ErrorResponseErrorInnererror + from ._models_py3 import Export + from ._models_py3 import ExportBlobList + from ._models_py3 import GetBitLockerKeysResponse + from ._models_py3 import JobDetails + from ._models_py3 import JobResponse + from ._models_py3 import JobResponseTags + from ._models_py3 import ListJobsResponse + from ._models_py3 import ListOperationsResponse + from ._models_py3 import Location + from ._models_py3 import LocationProperties + from ._models_py3 import LocationsResponse + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import PackageInfomation + from ._models_py3 import PutJobParameters + from ._models_py3 import PutJobParametersTags + from ._models_py3 import ReturnAddress + from ._models_py3 import ReturnShipping + from ._models_py3 import ShippingInformation + from ._models_py3 import UpdateJobParameters + from ._models_py3 import UpdateJobParametersProperties + from ._models_py3 import UpdateJobParametersTags +except (SyntaxError, ImportError): + from ._models import DriveBitLockerKey # type: ignore + from ._models import DriveStatus # type: ignore + from ._models import ErrorResponse, ErrorResponseException # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import ErrorResponseErrorDetailsItem # type: ignore + from ._models import ErrorResponseErrorInnererror # type: ignore + from ._models import Export # type: ignore + from ._models import ExportBlobList # type: ignore + from ._models import GetBitLockerKeysResponse # type: ignore + from ._models import JobDetails # type: ignore + from ._models import JobResponse # type: ignore + from ._models import JobResponseTags # type: ignore + from ._models import ListJobsResponse # type: ignore + from ._models import ListOperationsResponse # type: ignore + from ._models import Location # type: ignore + from ._models import LocationProperties # type: ignore + from ._models import LocationsResponse # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import PackageInfomation # type: ignore + from ._models import PutJobParameters # type: ignore + from ._models import PutJobParametersTags # type: ignore + from ._models import ReturnAddress # type: ignore + from ._models import ReturnShipping # type: ignore + from ._models import ShippingInformation # type: ignore + from ._models import UpdateJobParameters # type: ignore + from ._models import UpdateJobParametersProperties # type: ignore + from ._models import UpdateJobParametersTags # type: ignore +from ._storage_import_export_enums import ( + DriveState, +) + +__all__ = [ + 'DriveBitLockerKey', + 'DriveStatus', + 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseError', + 'ErrorResponseErrorDetailsItem', + 'ErrorResponseErrorInnererror', + 'Export', + 'ExportBlobList', + 'GetBitLockerKeysResponse', + 'JobDetails', + 'JobResponse', + 'JobResponseTags', + 'ListJobsResponse', + 'ListOperationsResponse', + 'Location', + 'LocationProperties', + 'LocationsResponse', + 'Operation', + 'OperationDisplay', + 'PackageInfomation', + 'PutJobParameters', + 'PutJobParametersTags', + 'ReturnAddress', + 'ReturnShipping', + 'ShippingInformation', + 'UpdateJobParameters', + 'UpdateJobParametersProperties', + 'UpdateJobParametersTags', + 'DriveState', +] diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models.py new file mode 100644 index 00000000000..065c998a993 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models.py @@ -0,0 +1,1175 @@ +# 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. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class DriveBitLockerKey(msrest.serialization.Model): + """BitLocker recovery key or password to the specified drive. + + :param bit_locker_key: BitLocker recovery key or password. + :type bit_locker_key: str + :param drive_id: Drive ID. + :type drive_id: str + """ + + _attribute_map = { + 'bit_locker_key': {'key': 'bitLockerKey', 'type': 'str'}, + 'drive_id': {'key': 'driveId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DriveBitLockerKey, self).__init__(**kwargs) + self.bit_locker_key = kwargs.get('bit_locker_key', None) + self.drive_id = kwargs.get('drive_id', None) + + +class DriveStatus(msrest.serialization.Model): + """Provides information about the drive's status. + + :param drive_id: The drive's hardware serial number, without spaces. + :type drive_id: str + :param bit_locker_key: The BitLocker key used to encrypt the drive. + :type bit_locker_key: str + :param manifest_file: The relative path of the manifest file on the drive. + :type manifest_file: str + :param manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :type manifest_hash: str + :param drive_header_hash: The drive header hash value. + :type drive_header_hash: str + :param state: The drive's current state. Possible values include: 'Specified', 'Received', + 'NeverReceived', 'Transferring', 'Completed', 'CompletedMoreInfo', 'ShippedBack'. + :type state: str or ~storage_import_export.models.DriveState + :param copy_status: Detailed status about the data transfer process. This field is not returned + in the response until the drive is in the Transferring state. + :type copy_status: str + :param percent_complete: Percentage completed for the drive. + :type percent_complete: int + :param verbose_log_uri: A URI that points to the blob containing the verbose log for the data + transfer operation. + :type verbose_log_uri: str + :param error_log_uri: A URI that points to the blob containing the error log for the data + transfer operation. + :type error_log_uri: str + :param manifest_uri: A URI that points to the blob containing the drive manifest file. + :type manifest_uri: str + :param bytes_succeeded: Bytes successfully transferred for the drive. + :type bytes_succeeded: long + """ + + _attribute_map = { + 'drive_id': {'key': 'driveId', 'type': 'str'}, + 'bit_locker_key': {'key': 'bitLockerKey', 'type': 'str'}, + 'manifest_file': {'key': 'manifestFile', 'type': 'str'}, + 'manifest_hash': {'key': 'manifestHash', 'type': 'str'}, + 'drive_header_hash': {'key': 'driveHeaderHash', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'copy_status': {'key': 'copyStatus', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + 'verbose_log_uri': {'key': 'verboseLogUri', 'type': 'str'}, + 'error_log_uri': {'key': 'errorLogUri', 'type': 'str'}, + 'manifest_uri': {'key': 'manifestUri', 'type': 'str'}, + 'bytes_succeeded': {'key': 'bytesSucceeded', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(DriveStatus, self).__init__(**kwargs) + self.drive_id = kwargs.get('drive_id', None) + self.bit_locker_key = kwargs.get('bit_locker_key', None) + self.manifest_file = kwargs.get('manifest_file', None) + self.manifest_hash = kwargs.get('manifest_hash', None) + self.drive_header_hash = kwargs.get('drive_header_hash', None) + self.state = kwargs.get('state', None) + self.copy_status = kwargs.get('copy_status', None) + self.percent_complete = kwargs.get('percent_complete', None) + self.verbose_log_uri = kwargs.get('verbose_log_uri', None) + self.error_log_uri = kwargs.get('error_log_uri', None) + self.manifest_uri = kwargs.get('manifest_uri', None) + self.bytes_succeeded = kwargs.get('bytes_succeeded', None) + + +class ErrorResponseException(HttpResponseError): + """Server responded with exception of type: 'ErrorResponse'. + + :param response: Server response to be deserialized. + :param error_model: A deserialized model of the response body as model. + """ + + def __init__(self, response, error_model): + self.error = error_model + super(ErrorResponseException, self).__init__(response=response, error_model=error_model) + + @classmethod + def from_response(cls, response, deserialize): + """Deserialize this response as this exception, or a subclass of this exception. + + :param response: Server response to be deserialized. + :param deserialize: A deserializer + """ + model_name = 'ErrorResponse' + error = deserialize(model_name, response) + if error is None: + error = deserialize.dependencies[model_name]() + return error._EXCEPTION_TYPE(response, error) + + +class ErrorResponse(msrest.serialization.Model): + """Response when errors occurred. + + :param code: Provides information about the error code. + :type code: str + :param message: Provides information about the error message. + :type message: str + :param target: Provides information about the error target. + :type target: str + :param details: Describes the error details if present. + :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: ~storage_import_export.models.ErrorResponseErrorInnererror + """ + _EXCEPTION_TYPE = ErrorResponseException + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[ErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'error.innererror', 'type': 'ErrorResponseErrorInnererror'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.innererror = kwargs.get('innererror', None) + + +class ErrorResponseError(msrest.serialization.Model): + """Describes the error information. + + :param code: Provides information about the error code. + :type code: str + :param message: Provides information about the error message. + :type message: str + :param target: Provides information about the error target. + :type target: str + :param details: Describes the error details if present. + :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: ~storage_import_export.models.ErrorResponseErrorInnererror + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'innererror', 'type': 'ErrorResponseErrorInnererror'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.innererror = kwargs.get('innererror', None) + + +class ErrorResponseErrorDetailsItem(msrest.serialization.Model): + """ErrorResponseErrorDetailsItem. + + :param code: Provides information about the error code. + :type code: str + :param target: Provides information about the error target. + :type target: str + :param message: Provides information about the error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseErrorDetailsItem, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.target = kwargs.get('target', None) + self.message = kwargs.get('message', None) + + +class ErrorResponseErrorInnererror(msrest.serialization.Model): + """Inner error object if present. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseErrorInnererror, self).__init__(**kwargs) + + +class Export(msrest.serialization.Model): + """A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs. + + :param blob_listblob_path: The relative URI to the block blob that contains the list of blob + paths or blob path prefixes as defined above, beginning with the container name. If the blob is + in root container, the URI must begin with $root. + :type blob_listblob_path: str + :param blob_path: A collection of blob-path strings. + :type blob_path: list[str] + :param blob_path_prefix: A collection of blob-prefix strings. + :type blob_path_prefix: list[str] + """ + + _attribute_map = { + 'blob_listblob_path': {'key': 'blobListblobPath', 'type': 'str'}, + 'blob_path': {'key': 'blobList.blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobList.blobPathPrefix', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Export, self).__init__(**kwargs) + self.blob_listblob_path = kwargs.get('blob_listblob_path', None) + self.blob_path = kwargs.get('blob_path', None) + self.blob_path_prefix = kwargs.get('blob_path_prefix', None) + + +class ExportBlobList(msrest.serialization.Model): + """A list of the blobs to be exported. + + :param blob_path: A collection of blob-path strings. + :type blob_path: list[str] + :param blob_path_prefix: A collection of blob-prefix strings. + :type blob_path_prefix: list[str] + """ + + _attribute_map = { + 'blob_path': {'key': 'blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobPathPrefix', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportBlobList, self).__init__(**kwargs) + self.blob_path = kwargs.get('blob_path', None) + self.blob_path_prefix = kwargs.get('blob_path_prefix', None) + + +class GetBitLockerKeysResponse(msrest.serialization.Model): + """GetBitLockerKeys response. + + :param value: drive status. + :type value: list[~storage_import_export.models.DriveBitLockerKey] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DriveBitLockerKey]'}, + } + + def __init__( + self, + **kwargs + ): + super(GetBitLockerKeysResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class JobDetails(msrest.serialization.Model): + """Specifies the job properties. + + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + """ + + _attribute_map = { + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'job_type': {'key': 'jobType', 'type': 'str'}, + 'return_address': {'key': 'returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'returnShipping', 'type': 'ReturnShipping'}, + 'shipping_information': {'key': 'shippingInformation', 'type': 'ShippingInformation'}, + 'delivery_package': {'key': 'deliveryPackage', 'type': 'PackageInfomation'}, + 'return_package': {'key': 'returnPackage', 'type': 'PackageInfomation'}, + 'diagnostics_path': {'key': 'diagnosticsPath', 'type': 'str'}, + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'backupDriveManifest', 'type': 'bool'}, + 'state': {'key': 'state', 'type': 'str'}, + 'cancel_requested': {'key': 'cancelRequested', 'type': 'bool'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + 'incomplete_blob_list_uri': {'key': 'incompleteBlobListUri', 'type': 'str'}, + 'drive_list': {'key': 'driveList', 'type': '[DriveStatus]'}, + 'export': {'key': 'export', 'type': 'Export'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobDetails, self).__init__(**kwargs) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.job_type = kwargs.get('job_type', None) + self.return_address = kwargs.get('return_address', None) + self.return_shipping = kwargs.get('return_shipping', None) + self.shipping_information = kwargs.get('shipping_information', None) + self.delivery_package = kwargs.get('delivery_package', None) + self.return_package = kwargs.get('return_package', None) + self.diagnostics_path = kwargs.get('diagnostics_path', None) + self.log_level = kwargs.get('log_level', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) + self.state = kwargs.get('state', None) + self.cancel_requested = kwargs.get('cancel_requested', None) + self.percent_complete = kwargs.get('percent_complete', None) + self.incomplete_blob_list_uri = kwargs.get('incomplete_blob_list_uri', None) + self.drive_list = kwargs.get('drive_list', None) + self.export = kwargs.get('export', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class JobResponse(msrest.serialization.Model): + """Contains the job information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Specifies the resource identifier of the job. + :vartype id: str + :ivar name: Specifies the name of the job. + :vartype name: str + :ivar type: Specifies the type of the job resource. + :vartype type: str + :param location: Specifies the Azure location where the job is created. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the job. + :type tags: ~storage_import_export.models.JobResponseTags + :param properties: Specifies the job properties. + :type properties: ~storage_import_export.models.JobDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'JobResponseTags'}, + 'properties': {'key': 'properties', 'type': 'JobDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class JobResponseTags(msrest.serialization.Model): + """Specifies the tags that are assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(JobResponseTags, self).__init__(**kwargs) + + +class ListJobsResponse(msrest.serialization.Model): + """List jobs response. + + :param next_link: link to next batch of jobs. + :type next_link: str + :param value: Job list. + :type value: list[~storage_import_export.models.JobResponse] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[JobResponse]'}, + } + + def __init__( + self, + **kwargs + ): + super(ListJobsResponse, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class ListOperationsResponse(msrest.serialization.Model): + """List operations response. + + :param value: operations. + :type value: list[~storage_import_export.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ListOperationsResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Location(msrest.serialization.Model): + """Provides information about an Azure data center location. + + :param id: Specifies the resource identifier of the location. + :type id: str + :param name: Specifies the name of the location. Use List Locations to get all supported + locations. + :type name: str + :param type: Specifies the type of the location. + :type type: str + :param recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :type recipient_name: str + :param street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address1: str + :param street_address2: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address2: str + :param city: The city name to use when shipping the drives to the Azure data center. + :type city: str + :param state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :type state_or_province: str + :param postal_code: The postal code to use when shipping the drives to the Azure data center. + :type postal_code: str + :param country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :type country_or_region: str + :param phone: The phone number for the Azure data center. + :type phone: str + :param supported_carriers: A list of carriers that are supported at this location. + :type supported_carriers: list[str] + :param alternate_locations: A list of location IDs that should be used to ship shipping drives + to for jobs created against the current location. If the current location is active, it will be + part of the list. If it is temporarily closed due to maintenance, this list may contain other + locations. + :type alternate_locations: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'recipient_name': {'key': 'properties.recipientName', 'type': 'str'}, + 'street_address1': {'key': 'properties.streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'properties.streetAddress2', 'type': 'str'}, + 'city': {'key': 'properties.city', 'type': 'str'}, + 'state_or_province': {'key': 'properties.stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'properties.postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'properties.countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'properties.phone', 'type': 'str'}, + 'supported_carriers': {'key': 'properties.supportedCarriers', 'type': '[str]'}, + 'alternate_locations': {'key': 'properties.alternateLocations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Location, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.recipient_name = kwargs.get('recipient_name', None) + self.street_address1 = kwargs.get('street_address1', None) + self.street_address2 = kwargs.get('street_address2', None) + self.city = kwargs.get('city', None) + self.state_or_province = kwargs.get('state_or_province', None) + self.postal_code = kwargs.get('postal_code', None) + self.country_or_region = kwargs.get('country_or_region', None) + self.phone = kwargs.get('phone', None) + self.supported_carriers = kwargs.get('supported_carriers', None) + self.alternate_locations = kwargs.get('alternate_locations', None) + + +class LocationProperties(msrest.serialization.Model): + """location properties. + + :param recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :type recipient_name: str + :param street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address1: str + :param street_address2: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address2: str + :param city: The city name to use when shipping the drives to the Azure data center. + :type city: str + :param state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :type state_or_province: str + :param postal_code: The postal code to use when shipping the drives to the Azure data center. + :type postal_code: str + :param country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :type country_or_region: str + :param phone: The phone number for the Azure data center. + :type phone: str + :param supported_carriers: A list of carriers that are supported at this location. + :type supported_carriers: list[str] + :param alternate_locations: A list of location IDs that should be used to ship shipping drives + to for jobs created against the current location. If the current location is active, it will be + part of the list. If it is temporarily closed due to maintenance, this list may contain other + locations. + :type alternate_locations: list[str] + """ + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'supported_carriers': {'key': 'supportedCarriers', 'type': '[str]'}, + 'alternate_locations': {'key': 'alternateLocations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(LocationProperties, self).__init__(**kwargs) + self.recipient_name = kwargs.get('recipient_name', None) + self.street_address1 = kwargs.get('street_address1', None) + self.street_address2 = kwargs.get('street_address2', None) + self.city = kwargs.get('city', None) + self.state_or_province = kwargs.get('state_or_province', None) + self.postal_code = kwargs.get('postal_code', None) + self.country_or_region = kwargs.get('country_or_region', None) + self.phone = kwargs.get('phone', None) + self.supported_carriers = kwargs.get('supported_carriers', None) + self.alternate_locations = kwargs.get('alternate_locations', None) + + +class LocationsResponse(msrest.serialization.Model): + """Locations response. + + :param value: locations. + :type value: list[~storage_import_export.models.Location] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Location]'}, + } + + def __init__( + self, + **kwargs + ): + super(LocationsResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Operation(msrest.serialization.Model): + """Describes a supported operation by the Storage Import/Export job API. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the operation. + :type name: str + :param provider: The resource provider name to which the operation belongs. + :type provider: str + :param resource: The name of the resource to which the operation belongs. + :type resource: str + :param operation: The display name of the operation. + :type operation: str + :param description: Short description of the operation. + :type description: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationDisplay(msrest.serialization.Model): + """operation display properties. + + :param provider: The resource provider name to which the operation belongs. + :type provider: str + :param resource: The name of the resource to which the operation belongs. + :type resource: str + :param operation: The display name of the operation. + :type operation: str + :param description: Short description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class PackageInfomation(msrest.serialization.Model): + """Contains information about the package being shipped by the customer to the Microsoft data center. + + All required parameters must be populated in order to send to Azure. + + :param carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :type carrier_name: str + :param tracking_number: Required. The tracking number of the package. + :type tracking_number: str + :param drive_count: Required. The number of drives included in the package. + :type drive_count: int + :param ship_date: Required. The date when the package is shipped. + :type ship_date: str + """ + + _validation = { + 'carrier_name': {'required': True}, + 'tracking_number': {'required': True}, + 'drive_count': {'required': True}, + 'ship_date': {'required': True}, + } + + _attribute_map = { + 'carrier_name': {'key': 'carrierName', 'type': 'str'}, + 'tracking_number': {'key': 'trackingNumber', 'type': 'str'}, + 'drive_count': {'key': 'driveCount', 'type': 'int'}, + 'ship_date': {'key': 'shipDate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PackageInfomation, self).__init__(**kwargs) + self.carrier_name = kwargs.get('carrier_name', None) + self.tracking_number = kwargs.get('tracking_number', None) + self.drive_count = kwargs.get('drive_count', None) + self.ship_date = kwargs.get('ship_date', None) + + +class PutJobParameters(msrest.serialization.Model): + """Put Job parameters. + + :param location: Specifies the supported Azure location where the job should be created. + :type location: str + :param tags: A set of tags. Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.PutJobParametersTags + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'PutJobParametersTags'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, + 'return_address': {'key': 'properties.returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'properties.returnShipping', 'type': 'ReturnShipping'}, + 'shipping_information': {'key': 'properties.shippingInformation', 'type': 'ShippingInformation'}, + 'delivery_package': {'key': 'properties.deliveryPackage', 'type': 'PackageInfomation'}, + 'return_package': {'key': 'properties.returnPackage', 'type': 'PackageInfomation'}, + 'diagnostics_path': {'key': 'properties.diagnosticsPath', 'type': 'str'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'properties.backupDriveManifest', 'type': 'bool'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'cancel_requested': {'key': 'properties.cancelRequested', 'type': 'bool'}, + 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, + 'incomplete_blob_list_uri': {'key': 'properties.incompleteBlobListUri', 'type': 'str'}, + 'drive_list': {'key': 'properties.driveList', 'type': '[DriveStatus]'}, + 'export': {'key': 'properties.export', 'type': 'Export'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PutJobParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.storage_account_id = kwargs.get('storage_account_id', None) + self.job_type = kwargs.get('job_type', None) + self.return_address = kwargs.get('return_address', None) + self.return_shipping = kwargs.get('return_shipping', None) + self.shipping_information = kwargs.get('shipping_information', None) + self.delivery_package = kwargs.get('delivery_package', None) + self.return_package = kwargs.get('return_package', None) + self.diagnostics_path = kwargs.get('diagnostics_path', None) + self.log_level = kwargs.get('log_level', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) + self.state = kwargs.get('state', None) + self.cancel_requested = kwargs.get('cancel_requested', None) + self.percent_complete = kwargs.get('percent_complete', None) + self.incomplete_blob_list_uri = kwargs.get('incomplete_blob_list_uri', None) + self.drive_list = kwargs.get('drive_list', None) + self.export = kwargs.get('export', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PutJobParametersTags(msrest.serialization.Model): + """Specifies the tags that will be assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(PutJobParametersTags, self).__init__(**kwargs) + + +class ReturnAddress(msrest.serialization.Model): + """Specifies the return address information for the job. + + All required parameters must be populated in order to send to Azure. + + :param recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :type recipient_name: str + :param street_address1: Required. The first line of the street address to use when returning + the drives. + :type street_address1: str + :param street_address2: The first line of the street address to use when returning the drives. + :type street_address2: str + :param city: Required. The city name to use when returning the drives. + :type city: str + :param state_or_province: The state or province to use when returning the drives. + :type state_or_province: str + :param postal_code: Required. The postal code to use when returning the drives. + :type postal_code: str + :param country_or_region: Required. The country or region to use when returning the drives. + :type country_or_region: str + :param phone: Required. Phone number of the recipient of the returned drives. + :type phone: str + :param email: Required. Email address of the recipient of the returned drives. + :type email: str + """ + + _validation = { + 'recipient_name': {'required': True}, + 'street_address1': {'required': True}, + 'city': {'required': True}, + 'postal_code': {'required': True}, + 'country_or_region': {'required': True}, + 'phone': {'required': True}, + 'email': {'required': True}, + } + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReturnAddress, self).__init__(**kwargs) + self.recipient_name = kwargs.get('recipient_name', None) + self.street_address1 = kwargs.get('street_address1', None) + self.street_address2 = kwargs.get('street_address2', None) + self.city = kwargs.get('city', None) + self.state_or_province = kwargs.get('state_or_province', None) + self.postal_code = kwargs.get('postal_code', None) + self.country_or_region = kwargs.get('country_or_region', None) + self.phone = kwargs.get('phone', None) + self.email = kwargs.get('email', None) + + +class ReturnShipping(msrest.serialization.Model): + """Specifies the return carrier and customer's account with the carrier. + + All required parameters must be populated in order to send to Azure. + + :param carrier_name: Required. The carrier's name. + :type carrier_name: str + :param carrier_account_number: Required. The customer's account number with the carrier. + :type carrier_account_number: str + """ + + _validation = { + 'carrier_name': {'required': True}, + 'carrier_account_number': {'required': True}, + } + + _attribute_map = { + 'carrier_name': {'key': 'carrierName', 'type': 'str'}, + 'carrier_account_number': {'key': 'carrierAccountNumber', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReturnShipping, self).__init__(**kwargs) + self.carrier_name = kwargs.get('carrier_name', None) + self.carrier_account_number = kwargs.get('carrier_account_number', None) + + +class ShippingInformation(msrest.serialization.Model): + """Contains information about the Microsoft datacenter to which the drives should be shipped. + + All required parameters must be populated in order to send to Azure. + + :param recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :type recipient_name: str + :param street_address1: Required. The first line of the street address to use when returning + the drives. + :type street_address1: str + :param street_address2: The first line of the street address to use when returning the drives. + :type street_address2: str + :param city: Required. The city name to use when returning the drives. + :type city: str + :param state_or_province: Required. The state or province to use when returning the drives. + :type state_or_province: str + :param postal_code: Required. The postal code to use when returning the drives. + :type postal_code: str + :param country_or_region: Required. The country or region to use when returning the drives. + :type country_or_region: str + :param phone: Phone number of the recipient of the returned drives. + :type phone: str + """ + + _validation = { + 'recipient_name': {'required': True}, + 'street_address1': {'required': True}, + 'city': {'required': True}, + 'state_or_province': {'required': True}, + 'postal_code': {'required': True}, + 'country_or_region': {'required': True}, + } + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ShippingInformation, self).__init__(**kwargs) + self.recipient_name = kwargs.get('recipient_name', None) + self.street_address1 = kwargs.get('street_address1', None) + self.street_address2 = kwargs.get('street_address2', None) + self.city = kwargs.get('city', None) + self.state_or_province = kwargs.get('state_or_province', None) + self.postal_code = kwargs.get('postal_code', None) + self.country_or_region = kwargs.get('country_or_region', None) + self.phone = kwargs.get('phone', None) + + +class UpdateJobParameters(msrest.serialization.Model): + """Update Job parameters. + + :param tags: A set of tags. Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.UpdateJobParametersTags + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'UpdateJobParametersTags'}, + 'cancel_requested': {'key': 'properties.cancelRequested', 'type': 'bool'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'return_address': {'key': 'properties.returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'properties.returnShipping', 'type': 'ReturnShipping'}, + 'delivery_package': {'key': 'properties.deliveryPackage', 'type': 'PackageInfomation'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'properties.backupDriveManifest', 'type': 'bool'}, + 'drive_list': {'key': 'properties.driveList', 'type': '[DriveStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateJobParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.cancel_requested = kwargs.get('cancel_requested', None) + self.state = kwargs.get('state', None) + self.return_address = kwargs.get('return_address', None) + self.return_shipping = kwargs.get('return_shipping', None) + self.delivery_package = kwargs.get('delivery_package', None) + self.log_level = kwargs.get('log_level', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) + self.drive_list = kwargs.get('drive_list', None) + + +class UpdateJobParametersProperties(msrest.serialization.Model): + """Specifies the properties of a UpdateJob. + + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + """ + + _attribute_map = { + 'cancel_requested': {'key': 'cancelRequested', 'type': 'bool'}, + 'state': {'key': 'state', 'type': 'str'}, + 'return_address': {'key': 'returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'returnShipping', 'type': 'ReturnShipping'}, + 'delivery_package': {'key': 'deliveryPackage', 'type': 'PackageInfomation'}, + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'backupDriveManifest', 'type': 'bool'}, + 'drive_list': {'key': 'driveList', 'type': '[DriveStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateJobParametersProperties, self).__init__(**kwargs) + self.cancel_requested = kwargs.get('cancel_requested', None) + self.state = kwargs.get('state', None) + self.return_address = kwargs.get('return_address', None) + self.return_shipping = kwargs.get('return_shipping', None) + self.delivery_package = kwargs.get('delivery_package', None) + self.log_level = kwargs.get('log_level', None) + self.backup_drive_manifest = kwargs.get('backup_drive_manifest', None) + self.drive_list = kwargs.get('drive_list', None) + + +class UpdateJobParametersTags(msrest.serialization.Model): + """Specifies the tags that will be assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(UpdateJobParametersTags, self).__init__(**kwargs) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models_py3.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models_py3.py new file mode 100644 index 00000000000..2c04169486e --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_models_py3.py @@ -0,0 +1,1349 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class DriveBitLockerKey(msrest.serialization.Model): + """BitLocker recovery key or password to the specified drive. + + :param bit_locker_key: BitLocker recovery key or password. + :type bit_locker_key: str + :param drive_id: Drive ID. + :type drive_id: str + """ + + _attribute_map = { + 'bit_locker_key': {'key': 'bitLockerKey', 'type': 'str'}, + 'drive_id': {'key': 'driveId', 'type': 'str'}, + } + + def __init__( + self, + *, + bit_locker_key: Optional[str] = None, + drive_id: Optional[str] = None, + **kwargs + ): + super(DriveBitLockerKey, self).__init__(**kwargs) + self.bit_locker_key = bit_locker_key + self.drive_id = drive_id + + +class DriveStatus(msrest.serialization.Model): + """Provides information about the drive's status. + + :param drive_id: The drive's hardware serial number, without spaces. + :type drive_id: str + :param bit_locker_key: The BitLocker key used to encrypt the drive. + :type bit_locker_key: str + :param manifest_file: The relative path of the manifest file on the drive. + :type manifest_file: str + :param manifest_hash: The Base16-encoded MD5 hash of the manifest file on the drive. + :type manifest_hash: str + :param drive_header_hash: The drive header hash value. + :type drive_header_hash: str + :param state: The drive's current state. Possible values include: 'Specified', 'Received', + 'NeverReceived', 'Transferring', 'Completed', 'CompletedMoreInfo', 'ShippedBack'. + :type state: str or ~storage_import_export.models.DriveState + :param copy_status: Detailed status about the data transfer process. This field is not returned + in the response until the drive is in the Transferring state. + :type copy_status: str + :param percent_complete: Percentage completed for the drive. + :type percent_complete: int + :param verbose_log_uri: A URI that points to the blob containing the verbose log for the data + transfer operation. + :type verbose_log_uri: str + :param error_log_uri: A URI that points to the blob containing the error log for the data + transfer operation. + :type error_log_uri: str + :param manifest_uri: A URI that points to the blob containing the drive manifest file. + :type manifest_uri: str + :param bytes_succeeded: Bytes successfully transferred for the drive. + :type bytes_succeeded: long + """ + + _attribute_map = { + 'drive_id': {'key': 'driveId', 'type': 'str'}, + 'bit_locker_key': {'key': 'bitLockerKey', 'type': 'str'}, + 'manifest_file': {'key': 'manifestFile', 'type': 'str'}, + 'manifest_hash': {'key': 'manifestHash', 'type': 'str'}, + 'drive_header_hash': {'key': 'driveHeaderHash', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'copy_status': {'key': 'copyStatus', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + 'verbose_log_uri': {'key': 'verboseLogUri', 'type': 'str'}, + 'error_log_uri': {'key': 'errorLogUri', 'type': 'str'}, + 'manifest_uri': {'key': 'manifestUri', 'type': 'str'}, + 'bytes_succeeded': {'key': 'bytesSucceeded', 'type': 'long'}, + } + + def __init__( + self, + *, + drive_id: Optional[str] = None, + bit_locker_key: Optional[str] = None, + manifest_file: Optional[str] = None, + manifest_hash: Optional[str] = None, + drive_header_hash: Optional[str] = None, + state: Optional[Union[str, "DriveState"]] = None, + copy_status: Optional[str] = None, + percent_complete: Optional[int] = None, + verbose_log_uri: Optional[str] = None, + error_log_uri: Optional[str] = None, + manifest_uri: Optional[str] = None, + bytes_succeeded: Optional[int] = None, + **kwargs + ): + super(DriveStatus, self).__init__(**kwargs) + self.drive_id = drive_id + self.bit_locker_key = bit_locker_key + self.manifest_file = manifest_file + self.manifest_hash = manifest_hash + self.drive_header_hash = drive_header_hash + self.state = state + self.copy_status = copy_status + self.percent_complete = percent_complete + self.verbose_log_uri = verbose_log_uri + self.error_log_uri = error_log_uri + self.manifest_uri = manifest_uri + self.bytes_succeeded = bytes_succeeded + + +class ErrorResponseException(HttpResponseError): + """Server responded with exception of type: 'ErrorResponse'. + + :param response: Server response to be deserialized. + :param error_model: A deserialized model of the response body as model. + """ + + def __init__(self, response, error_model): + self.error = error_model + super(ErrorResponseException, self).__init__(response=response, error_model=error_model) + + @classmethod + def from_response(cls, response, deserialize): + """Deserialize this response as this exception, or a subclass of this exception. + + :param response: Server response to be deserialized. + :param deserialize: A deserializer + """ + model_name = 'ErrorResponse' + error = deserialize(model_name, response) + if error is None: + error = deserialize.dependencies[model_name]() + return error._EXCEPTION_TYPE(response, error) + + +class ErrorResponse(msrest.serialization.Model): + """Response when errors occurred. + + :param code: Provides information about the error code. + :type code: str + :param message: Provides information about the error message. + :type message: str + :param target: Provides information about the error target. + :type target: str + :param details: Describes the error details if present. + :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: ~storage_import_export.models.ErrorResponseErrorInnererror + """ + _EXCEPTION_TYPE = ErrorResponseException + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[ErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'error.innererror', 'type': 'ErrorResponseErrorInnererror'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ErrorResponseErrorDetailsItem"]] = None, + innererror: Optional["ErrorResponseErrorInnererror"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.innererror = innererror + + +class ErrorResponseError(msrest.serialization.Model): + """Describes the error information. + + :param code: Provides information about the error code. + :type code: str + :param message: Provides information about the error message. + :type message: str + :param target: Provides information about the error target. + :type target: str + :param details: Describes the error details if present. + :type details: list[~storage_import_export.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: ~storage_import_export.models.ErrorResponseErrorInnererror + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'innererror', 'type': 'ErrorResponseErrorInnererror'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ErrorResponseErrorDetailsItem"]] = None, + innererror: Optional["ErrorResponseErrorInnererror"] = None, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.innererror = innererror + + +class ErrorResponseErrorDetailsItem(msrest.serialization.Model): + """ErrorResponseErrorDetailsItem. + + :param code: Provides information about the error code. + :type code: str + :param target: Provides information about the error target. + :type target: str + :param message: Provides information about the error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ErrorResponseErrorDetailsItem, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class ErrorResponseErrorInnererror(msrest.serialization.Model): + """Inner error object if present. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseErrorInnererror, self).__init__(**kwargs) + + +class Export(msrest.serialization.Model): + """A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs. + + :param blob_listblob_path: The relative URI to the block blob that contains the list of blob + paths or blob path prefixes as defined above, beginning with the container name. If the blob is + in root container, the URI must begin with $root. + :type blob_listblob_path: str + :param blob_path: A collection of blob-path strings. + :type blob_path: list[str] + :param blob_path_prefix: A collection of blob-prefix strings. + :type blob_path_prefix: list[str] + """ + + _attribute_map = { + 'blob_listblob_path': {'key': 'blobListblobPath', 'type': 'str'}, + 'blob_path': {'key': 'blobList.blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobList.blobPathPrefix', 'type': '[str]'}, + } + + def __init__( + self, + *, + blob_listblob_path: Optional[str] = None, + blob_path: Optional[List[str]] = None, + blob_path_prefix: Optional[List[str]] = None, + **kwargs + ): + super(Export, self).__init__(**kwargs) + self.blob_listblob_path = blob_listblob_path + self.blob_path = blob_path + self.blob_path_prefix = blob_path_prefix + + +class ExportBlobList(msrest.serialization.Model): + """A list of the blobs to be exported. + + :param blob_path: A collection of blob-path strings. + :type blob_path: list[str] + :param blob_path_prefix: A collection of blob-prefix strings. + :type blob_path_prefix: list[str] + """ + + _attribute_map = { + 'blob_path': {'key': 'blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobPathPrefix', 'type': '[str]'}, + } + + def __init__( + self, + *, + blob_path: Optional[List[str]] = None, + blob_path_prefix: Optional[List[str]] = None, + **kwargs + ): + super(ExportBlobList, self).__init__(**kwargs) + self.blob_path = blob_path + self.blob_path_prefix = blob_path_prefix + + +class GetBitLockerKeysResponse(msrest.serialization.Model): + """GetBitLockerKeys response. + + :param value: drive status. + :type value: list[~storage_import_export.models.DriveBitLockerKey] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DriveBitLockerKey]'}, + } + + def __init__( + self, + *, + value: Optional[List["DriveBitLockerKey"]] = None, + **kwargs + ): + super(GetBitLockerKeysResponse, self).__init__(**kwargs) + self.value = value + + +class JobDetails(msrest.serialization.Model): + """Specifies the job properties. + + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + """ + + _attribute_map = { + 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, + 'job_type': {'key': 'jobType', 'type': 'str'}, + 'return_address': {'key': 'returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'returnShipping', 'type': 'ReturnShipping'}, + 'shipping_information': {'key': 'shippingInformation', 'type': 'ShippingInformation'}, + 'delivery_package': {'key': 'deliveryPackage', 'type': 'PackageInfomation'}, + 'return_package': {'key': 'returnPackage', 'type': 'PackageInfomation'}, + 'diagnostics_path': {'key': 'diagnosticsPath', 'type': 'str'}, + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'backupDriveManifest', 'type': 'bool'}, + 'state': {'key': 'state', 'type': 'str'}, + 'cancel_requested': {'key': 'cancelRequested', 'type': 'bool'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + 'incomplete_blob_list_uri': {'key': 'incompleteBlobListUri', 'type': 'str'}, + 'drive_list': {'key': 'driveList', 'type': '[DriveStatus]'}, + 'export': {'key': 'export', 'type': 'Export'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_account_id: Optional[str] = None, + job_type: Optional[str] = None, + return_address: Optional["ReturnAddress"] = None, + return_shipping: Optional["ReturnShipping"] = None, + shipping_information: Optional["ShippingInformation"] = None, + delivery_package: Optional["PackageInfomation"] = None, + return_package: Optional["PackageInfomation"] = None, + diagnostics_path: Optional[str] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + state: Optional[str] = None, + cancel_requested: Optional[bool] = None, + percent_complete: Optional[int] = None, + incomplete_blob_list_uri: Optional[str] = None, + drive_list: Optional[List["DriveStatus"]] = None, + export: Optional["Export"] = None, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(JobDetails, self).__init__(**kwargs) + self.storage_account_id = storage_account_id + self.job_type = job_type + self.return_address = return_address + self.return_shipping = return_shipping + self.shipping_information = shipping_information + self.delivery_package = delivery_package + self.return_package = return_package + self.diagnostics_path = diagnostics_path + self.log_level = log_level + self.backup_drive_manifest = backup_drive_manifest + self.state = state + self.cancel_requested = cancel_requested + self.percent_complete = percent_complete + self.incomplete_blob_list_uri = incomplete_blob_list_uri + self.drive_list = drive_list + self.export = export + self.provisioning_state = provisioning_state + + +class JobResponse(msrest.serialization.Model): + """Contains the job information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Specifies the resource identifier of the job. + :vartype id: str + :ivar name: Specifies the name of the job. + :vartype name: str + :ivar type: Specifies the type of the job resource. + :vartype type: str + :param location: Specifies the Azure location where the job is created. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the job. + :type tags: dict[str, str] + :param properties: Specifies the job properties. + :type properties: ~storage_import_export.models.JobDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'JobDetails'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["JobDetails"] = None, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + + +class JobResponseTags(msrest.serialization.Model): + """Specifies the tags that are assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(JobResponseTags, self).__init__(**kwargs) + + +class ListJobsResponse(msrest.serialization.Model): + """List jobs response. + + :param next_link: link to next batch of jobs. + :type next_link: str + :param value: Job list. + :type value: list[~storage_import_export.models.JobResponse] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[JobResponse]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["JobResponse"]] = None, + **kwargs + ): + super(ListJobsResponse, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ListOperationsResponse(msrest.serialization.Model): + """List operations response. + + :param value: operations. + :type value: list[~storage_import_export.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(ListOperationsResponse, self).__init__(**kwargs) + self.value = value + + +class Location(msrest.serialization.Model): + """Provides information about an Azure data center location. + + :param id: Specifies the resource identifier of the location. + :type id: str + :param name: Specifies the name of the location. Use List Locations to get all supported + locations. + :type name: str + :param type: Specifies the type of the location. + :type type: str + :param recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :type recipient_name: str + :param street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address1: str + :param street_address2: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address2: str + :param city: The city name to use when shipping the drives to the Azure data center. + :type city: str + :param state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :type state_or_province: str + :param postal_code: The postal code to use when shipping the drives to the Azure data center. + :type postal_code: str + :param country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :type country_or_region: str + :param phone: The phone number for the Azure data center. + :type phone: str + :param supported_carriers: A list of carriers that are supported at this location. + :type supported_carriers: list[str] + :param alternate_locations: A list of location IDs that should be used to ship shipping drives + to for jobs created against the current location. If the current location is active, it will be + part of the list. If it is temporarily closed due to maintenance, this list may contain other + locations. + :type alternate_locations: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'recipient_name': {'key': 'properties.recipientName', 'type': 'str'}, + 'street_address1': {'key': 'properties.streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'properties.streetAddress2', 'type': 'str'}, + 'city': {'key': 'properties.city', 'type': 'str'}, + 'state_or_province': {'key': 'properties.stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'properties.postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'properties.countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'properties.phone', 'type': 'str'}, + 'supported_carriers': {'key': 'properties.supportedCarriers', 'type': '[str]'}, + 'alternate_locations': {'key': 'properties.alternateLocations', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + recipient_name: Optional[str] = None, + street_address1: Optional[str] = None, + street_address2: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + country_or_region: Optional[str] = None, + phone: Optional[str] = None, + supported_carriers: Optional[List[str]] = None, + alternate_locations: Optional[List[str]] = None, + **kwargs + ): + super(Location, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.recipient_name = recipient_name + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.city = city + self.state_or_province = state_or_province + self.postal_code = postal_code + self.country_or_region = country_or_region + self.phone = phone + self.supported_carriers = supported_carriers + self.alternate_locations = alternate_locations + + +class LocationProperties(msrest.serialization.Model): + """location properties. + + :param recipient_name: The recipient name to use when shipping the drives to the Azure data + center. + :type recipient_name: str + :param street_address1: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address1: str + :param street_address2: The first line of the street address to use when shipping the drives to + the Azure data center. + :type street_address2: str + :param city: The city name to use when shipping the drives to the Azure data center. + :type city: str + :param state_or_province: The state or province to use when shipping the drives to the Azure + data center. + :type state_or_province: str + :param postal_code: The postal code to use when shipping the drives to the Azure data center. + :type postal_code: str + :param country_or_region: The country or region to use when shipping the drives to the Azure + data center. + :type country_or_region: str + :param phone: The phone number for the Azure data center. + :type phone: str + :param supported_carriers: A list of carriers that are supported at this location. + :type supported_carriers: list[str] + :param alternate_locations: A list of location IDs that should be used to ship shipping drives + to for jobs created against the current location. If the current location is active, it will be + part of the list. If it is temporarily closed due to maintenance, this list may contain other + locations. + :type alternate_locations: list[str] + """ + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'supported_carriers': {'key': 'supportedCarriers', 'type': '[str]'}, + 'alternate_locations': {'key': 'alternateLocations', 'type': '[str]'}, + } + + def __init__( + self, + *, + recipient_name: Optional[str] = None, + street_address1: Optional[str] = None, + street_address2: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + country_or_region: Optional[str] = None, + phone: Optional[str] = None, + supported_carriers: Optional[List[str]] = None, + alternate_locations: Optional[List[str]] = None, + **kwargs + ): + super(LocationProperties, self).__init__(**kwargs) + self.recipient_name = recipient_name + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.city = city + self.state_or_province = state_or_province + self.postal_code = postal_code + self.country_or_region = country_or_region + self.phone = phone + self.supported_carriers = supported_carriers + self.alternate_locations = alternate_locations + + +class LocationsResponse(msrest.serialization.Model): + """Locations response. + + :param value: locations. + :type value: list[~storage_import_export.models.Location] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Location]'}, + } + + def __init__( + self, + *, + value: Optional[List["Location"]] = None, + **kwargs + ): + super(LocationsResponse, self).__init__(**kwargs) + self.value = value + + +class Operation(msrest.serialization.Model): + """Describes a supported operation by the Storage Import/Export job API. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the operation. + :type name: str + :param provider: The resource provider name to which the operation belongs. + :type provider: str + :param resource: The name of the resource to which the operation belongs. + :type resource: str + :param operation: The display name of the operation. + :type operation: str + :param description: Short description of the operation. + :type description: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationDisplay(msrest.serialization.Model): + """operation display properties. + + :param provider: The resource provider name to which the operation belongs. + :type provider: str + :param resource: The name of the resource to which the operation belongs. + :type resource: str + :param operation: The display name of the operation. + :type operation: str + :param description: Short description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class PackageInfomation(msrest.serialization.Model): + """Contains information about the package being shipped by the customer to the Microsoft data center. + + All required parameters must be populated in order to send to Azure. + + :param carrier_name: Required. The name of the carrier that is used to ship the import or + export drives. + :type carrier_name: str + :param tracking_number: Required. The tracking number of the package. + :type tracking_number: str + :param drive_count: Required. The number of drives included in the package. + :type drive_count: int + :param ship_date: Required. The date when the package is shipped. + :type ship_date: str + """ + + _validation = { + 'carrier_name': {'required': True}, + 'tracking_number': {'required': True}, + 'drive_count': {'required': True}, + 'ship_date': {'required': True}, + } + + _attribute_map = { + 'carrier_name': {'key': 'carrierName', 'type': 'str'}, + 'tracking_number': {'key': 'trackingNumber', 'type': 'str'}, + 'drive_count': {'key': 'driveCount', 'type': 'int'}, + 'ship_date': {'key': 'shipDate', 'type': 'str'}, + } + + def __init__( + self, + *, + carrier_name: str, + tracking_number: str, + drive_count: int, + ship_date: str, + **kwargs + ): + super(PackageInfomation, self).__init__(**kwargs) + self.carrier_name = carrier_name + self.tracking_number = tracking_number + self.drive_count = drive_count + self.ship_date = ship_date + + +class PutJobParameters(msrest.serialization.Model): + """Put Job parameters. + + :param location: Specifies the supported Azure location where the job should be created. + :type location: str + :param tags: A set of tags. Specifies the tags that will be assigned to the job. + :type tags: dict[str, str] + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'storage_account_id': {'key': 'properties.storageAccountId', 'type': 'str'}, + 'job_type': {'key': 'properties.jobType', 'type': 'str'}, + 'return_address': {'key': 'properties.returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'properties.returnShipping', 'type': 'ReturnShipping'}, + 'shipping_information': {'key': 'properties.shippingInformation', 'type': 'ShippingInformation'}, + 'delivery_package': {'key': 'properties.deliveryPackage', 'type': 'PackageInfomation'}, + 'return_package': {'key': 'properties.returnPackage', 'type': 'PackageInfomation'}, + 'diagnostics_path': {'key': 'properties.diagnosticsPath', 'type': 'str'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'properties.backupDriveManifest', 'type': 'bool'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'cancel_requested': {'key': 'properties.cancelRequested', 'type': 'bool'}, + 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, + 'incomplete_blob_list_uri': {'key': 'properties.incompleteBlobListUri', 'type': 'str'}, + 'drive_list': {'key': 'properties.driveList', 'type': '[DriveStatus]'}, + 'export': {'key': 'properties.export', 'type': 'Export'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + storage_account_id: Optional[str] = None, + job_type: Optional[str] = None, + return_address: Optional["ReturnAddress"] = None, + return_shipping: Optional["ReturnShipping"] = None, + shipping_information: Optional["ShippingInformation"] = None, + delivery_package: Optional["PackageInfomation"] = None, + return_package: Optional["PackageInfomation"] = None, + diagnostics_path: Optional[str] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + state: Optional[str] = None, + cancel_requested: Optional[bool] = None, + percent_complete: Optional[int] = None, + incomplete_blob_list_uri: Optional[str] = None, + drive_list: Optional[List["DriveStatus"]] = None, + export: Optional["Export"] = None, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(PutJobParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.storage_account_id = storage_account_id + self.job_type = job_type + self.return_address = return_address + self.return_shipping = return_shipping + self.shipping_information = shipping_information + self.delivery_package = delivery_package + self.return_package = return_package + self.diagnostics_path = diagnostics_path + self.log_level = log_level + self.backup_drive_manifest = backup_drive_manifest + self.state = state + self.cancel_requested = cancel_requested + self.percent_complete = percent_complete + self.incomplete_blob_list_uri = incomplete_blob_list_uri + self.drive_list = drive_list + self.export = export + self.provisioning_state = provisioning_state + + +class PutJobParametersTags(msrest.serialization.Model): + """Specifies the tags that will be assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(PutJobParametersTags, self).__init__(**kwargs) + + +class ReturnAddress(msrest.serialization.Model): + """Specifies the return address information for the job. + + All required parameters must be populated in order to send to Azure. + + :param recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :type recipient_name: str + :param street_address1: Required. The first line of the street address to use when returning + the drives. + :type street_address1: str + :param street_address2: The first line of the street address to use when returning the drives. + :type street_address2: str + :param city: Required. The city name to use when returning the drives. + :type city: str + :param state_or_province: The state or province to use when returning the drives. + :type state_or_province: str + :param postal_code: Required. The postal code to use when returning the drives. + :type postal_code: str + :param country_or_region: Required. The country or region to use when returning the drives. + :type country_or_region: str + :param phone: Required. Phone number of the recipient of the returned drives. + :type phone: str + :param email: Required. Email address of the recipient of the returned drives. + :type email: str + """ + + _validation = { + 'recipient_name': {'required': True}, + 'street_address1': {'required': True}, + 'city': {'required': True}, + 'postal_code': {'required': True}, + 'country_or_region': {'required': True}, + 'phone': {'required': True}, + 'email': {'required': True}, + } + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__( + self, + *, + recipient_name: str, + street_address1: str, + city: str, + postal_code: str, + country_or_region: str, + phone: str, + email: str, + street_address2: Optional[str] = None, + state_or_province: Optional[str] = None, + **kwargs + ): + super(ReturnAddress, self).__init__(**kwargs) + self.recipient_name = recipient_name + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.city = city + self.state_or_province = state_or_province + self.postal_code = postal_code + self.country_or_region = country_or_region + self.phone = phone + self.email = email + + +class ReturnShipping(msrest.serialization.Model): + """Specifies the return carrier and customer's account with the carrier. + + All required parameters must be populated in order to send to Azure. + + :param carrier_name: Required. The carrier's name. + :type carrier_name: str + :param carrier_account_number: Required. The customer's account number with the carrier. + :type carrier_account_number: str + """ + + _validation = { + 'carrier_name': {'required': True}, + 'carrier_account_number': {'required': True}, + } + + _attribute_map = { + 'carrier_name': {'key': 'carrierName', 'type': 'str'}, + 'carrier_account_number': {'key': 'carrierAccountNumber', 'type': 'str'}, + } + + def __init__( + self, + *, + carrier_name: str, + carrier_account_number: str, + **kwargs + ): + super(ReturnShipping, self).__init__(**kwargs) + self.carrier_name = carrier_name + self.carrier_account_number = carrier_account_number + + +class ShippingInformation(msrest.serialization.Model): + """Contains information about the Microsoft datacenter to which the drives should be shipped. + + All required parameters must be populated in order to send to Azure. + + :param recipient_name: Required. The name of the recipient who will receive the hard drives + when they are returned. + :type recipient_name: str + :param street_address1: Required. The first line of the street address to use when returning + the drives. + :type street_address1: str + :param street_address2: The first line of the street address to use when returning the drives. + :type street_address2: str + :param city: Required. The city name to use when returning the drives. + :type city: str + :param state_or_province: Required. The state or province to use when returning the drives. + :type state_or_province: str + :param postal_code: Required. The postal code to use when returning the drives. + :type postal_code: str + :param country_or_region: Required. The country or region to use when returning the drives. + :type country_or_region: str + :param phone: Phone number of the recipient of the returned drives. + :type phone: str + """ + + _validation = { + 'recipient_name': {'required': True}, + 'street_address1': {'required': True}, + 'city': {'required': True}, + 'state_or_province': {'required': True}, + 'postal_code': {'required': True}, + 'country_or_region': {'required': True}, + } + + _attribute_map = { + 'recipient_name': {'key': 'recipientName', 'type': 'str'}, + 'street_address1': {'key': 'streetAddress1', 'type': 'str'}, + 'street_address2': {'key': 'streetAddress2', 'type': 'str'}, + 'city': {'key': 'city', 'type': 'str'}, + 'state_or_province': {'key': 'stateOrProvince', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + *, + recipient_name: str, + street_address1: str, + city: str, + state_or_province: str, + postal_code: str, + country_or_region: str, + street_address2: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): + super(ShippingInformation, self).__init__(**kwargs) + self.recipient_name = recipient_name + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.city = city + self.state_or_province = state_or_province + self.postal_code = postal_code + self.country_or_region = country_or_region + self.phone = phone + + +class UpdateJobParameters(msrest.serialization.Model): + """Update Job parameters. + + :param tags: A set of tags. Specifies the tags that will be assigned to the job. + :type tags: dict[str, str] + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'cancel_requested': {'key': 'properties.cancelRequested', 'type': 'bool'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'return_address': {'key': 'properties.returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'properties.returnShipping', 'type': 'ReturnShipping'}, + 'delivery_package': {'key': 'properties.deliveryPackage', 'type': 'PackageInfomation'}, + 'log_level': {'key': 'properties.logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'properties.backupDriveManifest', 'type': 'bool'}, + 'drive_list': {'key': 'properties.driveList', 'type': '[DriveStatus]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + cancel_requested: Optional[bool] = None, + state: Optional[str] = None, + return_address: Optional["ReturnAddress"] = None, + return_shipping: Optional["ReturnShipping"] = None, + delivery_package: Optional["PackageInfomation"] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + drive_list: Optional[List["DriveStatus"]] = None, + **kwargs + ): + super(UpdateJobParameters, self).__init__(**kwargs) + self.tags = tags + self.cancel_requested = cancel_requested + self.state = state + self.return_address = return_address + self.return_shipping = return_shipping + self.delivery_package = delivery_package + self.log_level = log_level + self.backup_drive_manifest = backup_drive_manifest + self.drive_list = drive_list + + +class UpdateJobParametersProperties(msrest.serialization.Model): + """Specifies the properties of a UpdateJob. + + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + """ + + _attribute_map = { + 'cancel_requested': {'key': 'cancelRequested', 'type': 'bool'}, + 'state': {'key': 'state', 'type': 'str'}, + 'return_address': {'key': 'returnAddress', 'type': 'ReturnAddress'}, + 'return_shipping': {'key': 'returnShipping', 'type': 'ReturnShipping'}, + 'delivery_package': {'key': 'deliveryPackage', 'type': 'PackageInfomation'}, + 'log_level': {'key': 'logLevel', 'type': 'str'}, + 'backup_drive_manifest': {'key': 'backupDriveManifest', 'type': 'bool'}, + 'drive_list': {'key': 'driveList', 'type': '[DriveStatus]'}, + } + + def __init__( + self, + *, + cancel_requested: Optional[bool] = None, + state: Optional[str] = None, + return_address: Optional["ReturnAddress"] = None, + return_shipping: Optional["ReturnShipping"] = None, + delivery_package: Optional["PackageInfomation"] = None, + log_level: Optional[str] = None, + backup_drive_manifest: Optional[bool] = None, + drive_list: Optional[List["DriveStatus"]] = None, + **kwargs + ): + super(UpdateJobParametersProperties, self).__init__(**kwargs) + self.cancel_requested = cancel_requested + self.state = state + self.return_address = return_address + self.return_shipping = return_shipping + self.delivery_package = delivery_package + self.log_level = log_level + self.backup_drive_manifest = backup_drive_manifest + self.drive_list = drive_list + + +class UpdateJobParametersTags(msrest.serialization.Model): + """Specifies the tags that will be assigned to the job. + + """ + + _attribute_map = { + } + + def __init__( + self, + **kwargs + ): + super(UpdateJobParametersTags, self).__init__(**kwargs) diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_storage_import_export_enums.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_storage_import_export_enums.py new file mode 100644 index 00000000000..15d2d4f7186 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/models/_storage_import_export_enums.py @@ -0,0 +1,19 @@ +# 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. +# -------------------------------------------------------------------------- + +from enum import Enum + +class DriveState(str, Enum): + + specified = "Specified" + received = "Received" + never_received = "NeverReceived" + transferring = "Transferring" + completed = "Completed" + completed_more_info = "CompletedMoreInfo" + shipped_back = "ShippedBack" diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/__init__.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/__init__.py new file mode 100644 index 00000000000..199c96e7a99 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/__init__.py @@ -0,0 +1,19 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._location_operations import LocationOperations +from ._job_operations import JobOperations +from ._bit_locker_key_operations import BitLockerKeyOperations +from ._operation_operations import OperationOperations + +__all__ = [ + 'LocationOperations', + 'JobOperations', + 'BitLockerKeyOperations', + 'OperationOperations', +] diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_bit_locker_key_operations.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_bit_locker_key_operations.py new file mode 100644 index 00000000000..900125234da --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_bit_locker_key_operations.py @@ -0,0 +1,114 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class BitLockerKeyOperations(object): + """BitLockerKeyOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + job_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.GetBitLockerKeysResponse" + """Returns the BitLocker Keys for all drives in the specified job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetBitLockerKeysResponse or the result of cls(response) + :rtype: ~storage_import_export.models.GetBitLockerKeysResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.GetBitLockerKeysResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('GetBitLockerKeysResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_job_operations.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_job_operations.py new file mode 100644 index 00000000000..a9654641626 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_job_operations.py @@ -0,0 +1,555 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class JobOperations(object): + """JobOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + top=None, # type: Optional[int] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ListJobsResponse" + """Returns all active and completed jobs in a subscription. + + :param top: An integer value that specifies how many jobs at most should be returned. The value + cannot exceed 100. + :type top: int + :param filter: Can be used to restrict the results to certain conditions. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListJobsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListJobsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ListJobsResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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 = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListJobsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ListJobsResponse" + """Returns all active and completed jobs in a resource group. + + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param top: An integer value that specifies how many jobs at most should be returned. The value + cannot exceed 100. + :type top: int + :param filter: Can be used to restrict the results to certain conditions. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListJobsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListJobsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ListJobsResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListJobsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs'} + + def get( + self, + job_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.JobResponse" + """Gets information about an existing job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.JobResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def update( + self, + job_name, # type: str + resource_group_name, # type: str + tags=None, # type: Optional["models.UpdateJobParametersTags"] + cancel_requested=None, # type: Optional[bool] + state=None, # type: Optional[str] + return_address=None, # type: Optional["models.ReturnAddress"] + return_shipping=None, # type: Optional["models.ReturnShipping"] + delivery_package=None, # type: Optional["models.PackageInfomation"] + log_level=None, # type: Optional[str] + backup_drive_manifest=None, # type: Optional[bool] + drive_list=None, # type: Optional[List["DriveStatus"]] + **kwargs # type: Any + ): + # type: (...) -> "models.JobResponse" + """Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param tags: Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.UpdateJobParametersTags + :param cancel_requested: If specified, the value must be true. The service will attempt to + cancel the job. + :type cancel_requested: bool + :param state: If specified, the value must be Shipping, which tells the Import/Export service + that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties + must have been set either in this request or in a previous request, otherwise the request will + fail. + :type state: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param log_level: Indicates whether error logging or verbose logging is enabled. + :type log_level: str + :param backup_drive_manifest: Indicates whether the manifest files on the drives should be + copied to block blobs. + :type backup_drive_manifest: bool + :param drive_list: List of drives that comprise the job. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.JobResponse"] + error_map = kwargs.pop('error_map', {}) + + body = models.UpdateJobParameters(tags=tags, cancel_requested=cancel_requested, state=state, return_address=return_address, return_shipping=return_shipping, delivery_package=delivery_package, log_level=log_level, backup_drive_manifest=backup_drive_manifest, drive_list=drive_list) + api_version = "2016-11-01" + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(body, 'UpdateJobParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def create( + self, + job_name, # type: str + resource_group_name, # type: str + client_tenant_id=None, # type: Optional[str] + location=None, # type: Optional[str] + tags=None, # type: Optional["models.PutJobParametersTags"] + storage_account_id=None, # type: Optional[str] + job_type=None, # type: Optional[str] + return_address=None, # type: Optional["models.ReturnAddress"] + return_shipping=None, # type: Optional["models.ReturnShipping"] + shipping_information=None, # type: Optional["models.ShippingInformation"] + delivery_package=None, # type: Optional["models.PackageInfomation"] + return_package=None, # type: Optional["models.PackageInfomation"] + diagnostics_path=None, # type: Optional[str] + log_level=None, # type: Optional[str] + backup_drive_manifest=None, # type: Optional[bool] + state=None, # type: Optional[str] + cancel_requested=None, # type: Optional[bool] + percent_complete=None, # type: Optional[int] + incomplete_blob_list_uri=None, # type: Optional[str] + drive_list=None, # type: Optional[List["DriveStatus"]] + export=None, # type: Optional["models.Export"] + provisioning_state=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.JobResponse" + """Creates a new job or updates an existing job in the specified subscription. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :param client_tenant_id: The tenant ID of the client making the request. + :type client_tenant_id: str + :param location: Specifies the supported Azure location where the job should be created. + :type location: str + :param tags: Specifies the tags that will be assigned to the job. + :type tags: ~storage_import_export.models.PutJobParametersTags + :param storage_account_id: The resource identifier of the storage account where data will be + imported to or exported from. + :type storage_account_id: str + :param job_type: The type of job. + :type job_type: str + :param return_address: Specifies the return address information for the job. + :type return_address: ~storage_import_export.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's account with the carrier. + :type return_shipping: ~storage_import_export.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft datacenter to which the + drives should be shipped. + :type shipping_information: ~storage_import_export.models.ShippingInformation + :param delivery_package: Contains information about the package being shipped by the customer + to the Microsoft data center. + :type delivery_package: ~storage_import_export.models.PackageInfomation + :param return_package: Contains information about the package being shipped by the customer to + the Microsoft data center. + :type return_package: ~storage_import_export.models.PackageInfomation + :param diagnostics_path: The virtual blob directory to which the copy logs and backups of drive + manifest files (if enabled) will be stored. + :type diagnostics_path: str + :param log_level: Default value is Error. Indicates whether error logging or verbose logging + will be enabled. + :type log_level: str + :param backup_drive_manifest: Default value is false. Indicates whether the manifest files on + the drives should be copied to block blobs. + :type backup_drive_manifest: bool + :param state: Current state of the job. + :type state: str + :param cancel_requested: Indicates whether a request has been submitted to cancel the job. + :type cancel_requested: bool + :param percent_complete: Overall percentage completed for the job. + :type percent_complete: int + :param incomplete_blob_list_uri: A blob path that points to a block blob containing a list of + blob names that were not exported due to insufficient drive space. If all blobs were exported + successfully, then this element is not included in the response. + :type incomplete_blob_list_uri: str + :param drive_list: List of up to ten drives that comprise the job. The drive list is a required + element for an import job; it is not specified for export jobs. + :type drive_list: list[~storage_import_export.models.DriveStatus] + :param export: A property containing information about the blobs to be exported for an export + job. This property is required for export jobs, but must not be specified for import jobs. + :type export: ~storage_import_export.models.Export + :param provisioning_state: Specifies the provisioning state of the job. + :type provisioning_state: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse or JobResponse or the result of cls(response) + :rtype: ~storage_import_export.models.JobResponse or ~storage_import_export.models.JobResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.JobResponse"] + error_map = kwargs.pop('error_map', {}) + + body = models.PutJobParameters(location=location, tags=tags, storage_account_id=storage_account_id, job_type=job_type, return_address=return_address, return_shipping=return_shipping, shipping_information=shipping_information, delivery_package=delivery_package, return_package=return_package, diagnostics_path=diagnostics_path, log_level=log_level, backup_drive_manifest=backup_drive_manifest, state=state, cancel_requested=cancel_requested, percent_complete=percent_complete, incomplete_blob_list_uri=incomplete_blob_list_uri, drive_list=drive_list, export=export, provisioning_state=provisioning_state) + api_version = "2016-11-01" + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + if client_tenant_id is not None: + header_parameters['x-ms-client-tenant-id'] = self._serialize.header("client_tenant_id", client_tenant_id, 'str') + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json' + + # Construct body + body_content = self._serialize.body(body, 'PutJobParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('JobResponse', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def delete( + self, + job_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + + :param job_name: The name of the import/export job. + :type job_name: str + :param resource_group_name: The resource group name uniquely identifies the resource group + within the user subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType[None] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_location_operations.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_location_operations.py new file mode 100644 index 00000000000..746c1301657 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_location_operations.py @@ -0,0 +1,154 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class LocationOperations(object): + """LocationOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.LocationsResponse" + """Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft data center region. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LocationsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.LocationsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.LocationsResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('LocationsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ImportExport/locations'} + + def get( + self, + location_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Location" + """Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region. + + :param location_name: The name of the location. For example, West US or westus. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Location or the result of cls(response) + :rtype: ~storage_import_export.models.Location + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.Location"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + deserialized = self._deserialize('Location', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/providers/Microsoft.ImportExport/locations/{locationName}'} diff --git a/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_operation_operations.py b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_operation_operations.py new file mode 100644 index 00000000000..f93c99d47c8 --- /dev/null +++ b/src/import-export/azext_import_export/vendored_sdks/storageimportexport/operations/_operation_operations.py @@ -0,0 +1,101 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~storage_import_export.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ListOperationsResponse" + """Returns the list of operations supported by the import/export resource provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListOperationsResponse or the result of cls(response) + :rtype: ~storage_import_export.models.ListOperationsResponse + :raises: ~storage_import_export.models.ErrorResponseException: + """ + cls = kwargs.pop('cls', None ) # type: ClsType["models.ListOperationsResponse"] + error_map = kwargs.pop('error_map', {}) + api_version = "2016-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self._config.acceptlanguage is not None: + header_parameters['Accept-Language'] = self._serialize.header("self._config.acceptlanguage", self._config.acceptlanguage, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListOperationsResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise models.ErrorResponseException.from_response(response, self._deserialize) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ImportExport/operations'} diff --git a/src/import-export/setup.cfg b/src/import-export/setup.cfg new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/import-export/setup.py b/src/import-export/setup.py new file mode 100644 index 00000000000..0eaa32f0660 --- /dev/null +++ b/src/import-export/setup.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='import_export', + version=VERSION, + description='Microsoft Azure Command-Line Tools StorageImportExport 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', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_import_export': ['azext_metadata.json']}, +)