From 497cff4f0019d1e9188479f493c02f8d3d43d5bf Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Sat, 11 Apr 2020 15:09:14 +0200 Subject: [PATCH] Generated storageimportexport (#10670) * generated storageimportexport * generated tests * fixed test * Packaging update of azure-mgmt-storageimportexport * test recording * fixed test * moved storageimportexport under storage * fix changelog * removed SERVICE_NAME * Packaging update of azure-mgmt-storageimportexport * fix test * minor fix * modified test * invalid test * Packaging update of azure-mgmt-storageimportexport Co-authored-by: Azure SDK Bot --- .../CHANGELOG.md | 5 + .../MANIFEST.in | 5 + .../azure-mgmt-storageimportexport/README.md | 21 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/storageimportexport/__init__.py | 19 + .../storageimportexport/_configuration.py | 51 ++ .../_storage_import_export.py | 66 ++ .../storageimportexport/models/__init__.py | 73 ++ .../storageimportexport/models/_models.py | 753 ++++++++++++++++++ .../storageimportexport/models/_models_py3.py | 753 ++++++++++++++++++ .../models/_paged_models.py | 66 ++ .../models/_storage_import_export_enums.py | 23 + .../operations/__init__.py | 22 + .../operations/_bit_locker_keys_operations.py | 111 +++ .../operations/_jobs_operations.py | 453 +++++++++++ .../operations/_locations_operations.py | 160 ++++ .../operations/_operations.py | 101 +++ .../azure/mgmt/storageimportexport/version.py | 13 + .../sdk_packaging.toml | 8 + .../azure-mgmt-storageimportexport/setup.cfg | 2 + .../azure-mgmt-storageimportexport/setup.py | 88 ++ ...importexport.test_storageimportexport.yaml | 247 ++++++ .../test_cli_mgmt_storageimportexport.py | 112 +++ sdk/storage/ci.yml | 2 + 25 files changed, 3156 insertions(+) create mode 100644 sdk/storage/azure-mgmt-storageimportexport/CHANGELOG.md create mode 100644 sdk/storage/azure-mgmt-storageimportexport/MANIFEST.in create mode 100644 sdk/storage/azure-mgmt-storageimportexport/README.md create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/__init__.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/__init__.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/__init__.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_paged_models.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/__init__.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/version.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/sdk_packaging.toml create mode 100644 sdk/storage/azure-mgmt-storageimportexport/setup.cfg create mode 100644 sdk/storage/azure-mgmt-storageimportexport/setup.py create mode 100644 sdk/storage/azure-mgmt-storageimportexport/tests/recordings/test_cli_mgmt_storageimportexport.test_storageimportexport.yaml create mode 100644 sdk/storage/azure-mgmt-storageimportexport/tests/test_cli_mgmt_storageimportexport.py diff --git a/sdk/storage/azure-mgmt-storageimportexport/CHANGELOG.md b/sdk/storage/azure-mgmt-storageimportexport/CHANGELOG.md new file mode 100644 index 000000000000..68afb3958b60 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2020-04-11) + +* Initial Release diff --git a/sdk/storage/azure-mgmt-storageimportexport/MANIFEST.in b/sdk/storage/azure-mgmt-storageimportexport/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/storage/azure-mgmt-storageimportexport/README.md b/sdk/storage/azure-mgmt-storageimportexport/README.md new file mode 100644 index 000000000000..9aaf05fd5746 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure StorageImportExport Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) + + +# Usage + +For code examples, see [StorageImportExport Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-storageimportexport%2FREADME.png) diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__init__.py new file mode 100644 index 000000000000..ab735501f311 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/__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 ._configuration import StorageImportExportConfiguration +from ._storage_import_export import StorageImportExport +__all__ = ['StorageImportExport', 'StorageImportExportConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py new file mode 100644 index 000000000000..a9937ca7a989 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_configuration.py @@ -0,0 +1,51 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class StorageImportExportConfiguration(AzureConfiguration): + """Configuration for StorageImportExport + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param accept_language: Specifies the preferred language for the response. + :type accept_language: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, accept_language=None, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(StorageImportExportConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-storageimportexport/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + self.accept_language = accept_language diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py new file mode 100644 index 000000000000..5c206d255a34 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/_storage_import_export.py @@ -0,0 +1,66 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import StorageImportExportConfiguration +from .operations import LocationsOperations +from .operations import JobsOperations +from .operations import BitLockerKeysOperations +from .operations import Operations +from . import models + + +class StorageImportExport(SDKClient): + """The Storage Import/Export Resource Provider API. + + :ivar config: Configuration for client. + :vartype config: StorageImportExportConfiguration + + :ivar locations: Locations operations + :vartype locations: azure.mgmt.storageimportexport.operations.LocationsOperations + :ivar jobs: Jobs operations + :vartype jobs: azure.mgmt.storageimportexport.operations.JobsOperations + :ivar bit_locker_keys: BitLockerKeys operations + :vartype bit_locker_keys: azure.mgmt.storageimportexport.operations.BitLockerKeysOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.storageimportexport.operations.Operations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The subscription ID for the Azure user. + :type subscription_id: str + :param accept_language: Specifies the preferred language for the response. + :type accept_language: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, accept_language=None, base_url=None): + + self.config = StorageImportExportConfiguration(credentials, subscription_id, accept_language, base_url) + super(StorageImportExport, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2016-11-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.locations = LocationsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.jobs = JobsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.bit_locker_keys = BitLockerKeysOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/__init__.py new file mode 100644 index 000000000000..b0e2de402a44 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/__init__.py @@ -0,0 +1,73 @@ +# 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 ErrorResponseErrorDetailsItem + from ._models_py3 import Export + from ._models_py3 import JobDetails + from ._models_py3 import JobResponse + from ._models_py3 import Location + from ._models_py3 import Operation + from ._models_py3 import PackageInfomation + from ._models_py3 import PutJobParameters + from ._models_py3 import ReturnAddress + from ._models_py3 import ReturnShipping + from ._models_py3 import ShippingInformation + from ._models_py3 import UpdateJobParameters +except (SyntaxError, ImportError): + from ._models import DriveBitLockerKey + from ._models import DriveStatus + from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseErrorDetailsItem + from ._models import Export + from ._models import JobDetails + from ._models import JobResponse + from ._models import Location + from ._models import Operation + from ._models import PackageInfomation + from ._models import PutJobParameters + from ._models import ReturnAddress + from ._models import ReturnShipping + from ._models import ShippingInformation + from ._models import UpdateJobParameters +from ._paged_models import DriveBitLockerKeyPaged +from ._paged_models import JobResponsePaged +from ._paged_models import LocationPaged +from ._paged_models import OperationPaged +from ._storage_import_export_enums import ( + DriveState, +) + +__all__ = [ + 'DriveBitLockerKey', + 'DriveStatus', + 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseErrorDetailsItem', + 'Export', + 'JobDetails', + 'JobResponse', + 'Location', + 'Operation', + 'PackageInfomation', + 'PutJobParameters', + 'ReturnAddress', + 'ReturnShipping', + 'ShippingInformation', + 'UpdateJobParameters', + 'LocationPaged', + 'JobResponsePaged', + 'DriveBitLockerKeyPaged', + 'OperationPaged', + 'DriveState', +] diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py new file mode 100644 index 000000000000..9f8b1ba31d48 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models.py @@ -0,0 +1,753 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DriveBitLockerKey(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(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 ~azure.mgmt.storageimportexport.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 ErrorResponse(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[~azure.mgmt.storageimportexport.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: object + """ + + _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': 'object'}, + } + + 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 ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseErrorDetailsItem(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 Export(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_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] + :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 + """ + + _attribute_map = { + 'blob_path': {'key': 'blobList.blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobList.blobPathPrefix', 'type': '[str]'}, + 'blob_listblob_path': {'key': 'blobListblobPath', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Export, self).__init__(**kwargs) + self.blob_path = kwargs.get('blob_path', None) + self.blob_path_prefix = kwargs.get('blob_path_prefix', None) + self.blob_listblob_path = kwargs.get('blob_listblob_path', None) + + +class JobDetails(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: ~azure.mgmt.storageimportexport.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's + account with the carrier. + :type return_shipping: + ~azure.mgmt.storageimportexport.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft + datacenter to which the drives should be shipped. + :type shipping_information: + ~azure.mgmt.storageimportexport.models.ShippingInformation + :param delivery_package: Contains information about the package being + shipped by the customer to the Microsoft data center. + :type delivery_package: + ~azure.mgmt.storageimportexport.models.PackageInfomation + :param return_package: Contains information about the package being + shipped from the Microsoft data center to the customer to return the + drives. The format is the same as the deliveryPackage property above. This + property is not included if the drives have not yet been returned. + :type return_package: + ~azure.mgmt.storageimportexport.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[~azure.mgmt.storageimportexport.models.DriveStatus] + :param export: A property containing information about the blobs to be + exported for an export job. This property is included for export jobs + only. + :type export: ~azure.mgmt.storageimportexport.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(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: Specifies the tags that are assigned to the job. + :type tags: object + :param properties: Specifies the job properties + :type properties: ~azure.mgmt.storageimportexport.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': 'object'}, + '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 Location(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 second 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 Operation(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 PackageInfomation(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(Model): + """Put Job parameters. + + :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: object + :param properties: Specifies the job properties + :type properties: ~azure.mgmt.storageimportexport.models.JobDetails + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'JobDetails'}, + } + + def __init__(self, **kwargs): + super(PutJobParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class ReturnAddress(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 second 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(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(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 second 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(Model): + """Update Job parameters. + + :param tags: Specifies the tags that will be assigned to the job + :type tags: object + :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: ~azure.mgmt.storageimportexport.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's + account with the carrier. + :type return_shipping: + ~azure.mgmt.storageimportexport.models.ReturnShipping + :param delivery_package: Contains information about the package being + shipped by the customer to the Microsoft data center. + :type delivery_package: + ~azure.mgmt.storageimportexport.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[~azure.mgmt.storageimportexport.models.DriveStatus] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + '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) diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py new file mode 100644 index 000000000000..f8f4973efff9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_models_py3.py @@ -0,0 +1,753 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class DriveBitLockerKey(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: str=None, drive_id: str=None, **kwargs) -> None: + super(DriveBitLockerKey, self).__init__(**kwargs) + self.bit_locker_key = bit_locker_key + self.drive_id = drive_id + + +class DriveStatus(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 ~azure.mgmt.storageimportexport.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: str=None, bit_locker_key: str=None, manifest_file: str=None, manifest_hash: str=None, drive_header_hash: str=None, state=None, copy_status: str=None, percent_complete: int=None, verbose_log_uri: str=None, error_log_uri: str=None, manifest_uri: str=None, bytes_succeeded: int=None, **kwargs) -> None: + 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 ErrorResponse(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[~azure.mgmt.storageimportexport.models.ErrorResponseErrorDetailsItem] + :param innererror: Inner error object if present. + :type innererror: object + """ + + _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': 'object'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, innererror=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.innererror = innererror + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseErrorDetailsItem(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: str=None, target: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponseErrorDetailsItem, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class Export(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_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] + :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 + """ + + _attribute_map = { + 'blob_path': {'key': 'blobList.blobPath', 'type': '[str]'}, + 'blob_path_prefix': {'key': 'blobList.blobPathPrefix', 'type': '[str]'}, + 'blob_listblob_path': {'key': 'blobListblobPath', 'type': 'str'}, + } + + def __init__(self, *, blob_path=None, blob_path_prefix=None, blob_listblob_path: str=None, **kwargs) -> None: + super(Export, self).__init__(**kwargs) + self.blob_path = blob_path + self.blob_path_prefix = blob_path_prefix + self.blob_listblob_path = blob_listblob_path + + +class JobDetails(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: ~azure.mgmt.storageimportexport.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's + account with the carrier. + :type return_shipping: + ~azure.mgmt.storageimportexport.models.ReturnShipping + :param shipping_information: Contains information about the Microsoft + datacenter to which the drives should be shipped. + :type shipping_information: + ~azure.mgmt.storageimportexport.models.ShippingInformation + :param delivery_package: Contains information about the package being + shipped by the customer to the Microsoft data center. + :type delivery_package: + ~azure.mgmt.storageimportexport.models.PackageInfomation + :param return_package: Contains information about the package being + shipped from the Microsoft data center to the customer to return the + drives. The format is the same as the deliveryPackage property above. This + property is not included if the drives have not yet been returned. + :type return_package: + ~azure.mgmt.storageimportexport.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[~azure.mgmt.storageimportexport.models.DriveStatus] + :param export: A property containing information about the blobs to be + exported for an export job. This property is included for export jobs + only. + :type export: ~azure.mgmt.storageimportexport.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: str=None, job_type: str=None, return_address=None, return_shipping=None, shipping_information=None, delivery_package=None, return_package=None, diagnostics_path: str=None, log_level: str=None, backup_drive_manifest: bool=None, state: str=None, cancel_requested: bool=None, percent_complete: int=None, incomplete_blob_list_uri: str=None, drive_list=None, export=None, provisioning_state: str=None, **kwargs) -> None: + 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(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: Specifies the tags that are assigned to the job. + :type tags: object + :param properties: Specifies the job properties + :type properties: ~azure.mgmt.storageimportexport.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': 'object'}, + 'properties': {'key': 'properties', 'type': 'JobDetails'}, + } + + def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) -> None: + super(JobResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + + +class Location(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 second 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: str=None, name: str=None, type: str=None, recipient_name: str=None, street_address1: str=None, street_address2: str=None, city: str=None, state_or_province: str=None, postal_code: str=None, country_or_region: str=None, phone: str=None, supported_carriers=None, alternate_locations=None, **kwargs) -> None: + 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 Operation(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: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class PackageInfomation(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) -> None: + 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(Model): + """Put Job parameters. + + :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: object + :param properties: Specifies the job properties + :type properties: ~azure.mgmt.storageimportexport.models.JobDetails + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'JobDetails'}, + } + + def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) -> None: + super(PutJobParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.properties = properties + + +class ReturnAddress(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 second 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: str=None, state_or_province: str=None, **kwargs) -> None: + 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(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) -> None: + super(ReturnShipping, self).__init__(**kwargs) + self.carrier_name = carrier_name + self.carrier_account_number = carrier_account_number + + +class ShippingInformation(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 second 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: str=None, phone: str=None, **kwargs) -> None: + 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(Model): + """Update Job parameters. + + :param tags: Specifies the tags that will be assigned to the job + :type tags: object + :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: ~azure.mgmt.storageimportexport.models.ReturnAddress + :param return_shipping: Specifies the return carrier and customer's + account with the carrier. + :type return_shipping: + ~azure.mgmt.storageimportexport.models.ReturnShipping + :param delivery_package: Contains information about the package being + shipped by the customer to the Microsoft data center. + :type delivery_package: + ~azure.mgmt.storageimportexport.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[~azure.mgmt.storageimportexport.models.DriveStatus] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + '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=None, cancel_requested: bool=None, state: str=None, return_address=None, return_shipping=None, delivery_package=None, log_level: str=None, backup_drive_manifest: bool=None, drive_list=None, **kwargs) -> None: + 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 diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_paged_models.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_paged_models.py new file mode 100644 index 000000000000..ee17e76ff59d --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_paged_models.py @@ -0,0 +1,66 @@ +# 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 msrest.paging import Paged + + +class LocationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Location ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Location]'} + } + + def __init__(self, *args, **kwargs): + + super(LocationPaged, self).__init__(*args, **kwargs) +class JobResponsePaged(Paged): + """ + A paging container for iterating over a list of :class:`JobResponse ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[JobResponse]'} + } + + def __init__(self, *args, **kwargs): + + super(JobResponsePaged, self).__init__(*args, **kwargs) +class DriveBitLockerKeyPaged(Paged): + """ + A paging container for iterating over a list of :class:`DriveBitLockerKey ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DriveBitLockerKey]'} + } + + def __init__(self, *args, **kwargs): + + super(DriveBitLockerKeyPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py new file mode 100644 index 000000000000..e1ed05a35cdb --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/models/_storage_import_export_enums.py @@ -0,0 +1,23 @@ +# 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/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/__init__.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/__init__.py new file mode 100644 index 000000000000..cce514cc5420 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/__init__.py @@ -0,0 +1,22 @@ +# 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 ._locations_operations import LocationsOperations +from ._jobs_operations import JobsOperations +from ._bit_locker_keys_operations import BitLockerKeysOperations +from ._operations import Operations + +__all__ = [ + 'LocationsOperations', + 'JobsOperations', + 'BitLockerKeysOperations', + 'Operations', +] diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py new file mode 100644 index 000000000000..8efec2d55d14 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_bit_locker_keys_operations.py @@ -0,0 +1,111 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BitLockerKeysOperations(object): + """BitLockerKeysOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Specifies the API version to use for this request. Constant value: "2016-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-11-01" + + self.config = config + + def list( + self, job_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DriveBitLockerKey + :rtype: + ~azure.mgmt.storageimportexport.models.DriveBitLockerKeyPaged[~azure.mgmt.storageimportexport.models.DriveBitLockerKey] + :raises: + :class:`ErrorResponseException` + """ + 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) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DriveBitLockerKeyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys'} diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py new file mode 100644 index 000000000000..3b79298ba236 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_jobs_operations.py @@ -0,0 +1,453 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class JobsOperations(object): + """JobsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Specifies the API version to use for this request. Constant value: "2016-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-11-01" + + self.config = config + + def list_by_subscription( + self, top=None, filter=None, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of JobResponse + :rtype: + ~azure.mgmt.storageimportexport.models.JobResponsePaged[~azure.mgmt.storageimportexport.models.JobResponse] + :raises: + :class:`ErrorResponseException` + """ + 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("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.JobResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'} + + def list_by_resource_group( + self, resource_group_name, top=None, filter=None, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of JobResponse + :rtype: + ~azure.mgmt.storageimportexport.models.JobResponsePaged[~azure.mgmt.storageimportexport.models.JobResponse] + :raises: + :class:`ErrorResponseException` + """ + 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("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.JobResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs'} + + def get( + self, job_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storageimportexport.models.JobResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('JobResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def update( + self, job_name, resource_group_name, body, custom_headers=None, raw=False, **operation_config): + """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 body: The parameters to update in the job + :type body: ~azure.mgmt.storageimportexport.models.UpdateJobParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storageimportexport.models.JobResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'UpdateJobParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('JobResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def create( + self, job_name, resource_group_name, body, client_tenant_id=None, custom_headers=None, raw=False, **operation_config): + """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 body: The parameters used for creating the job + :type body: ~azure.mgmt.storageimportexport.models.PutJobParameters + :param client_tenant_id: The tenant ID of the client making the + request. + :type client_tenant_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: JobResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storageimportexport.models.JobResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, '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') + + # Construct body + body_content = self._serialize.body(body, 'PutJobParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('JobResponse', response) + if response.status_code == 201: + deserialized = self._deserialize('JobResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} + + def delete( + self, job_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'} diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py new file mode 100644 index 000000000000..8b3b314d555c --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_locations_operations.py @@ -0,0 +1,160 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class LocationsOperations(object): + """LocationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Specifies the API version to use for this request. Constant value: "2016-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-11-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """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. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Location + :rtype: + ~azure.mgmt.storageimportexport.models.LocationPaged[~azure.mgmt.storageimportexport.models.Location] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.LocationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ImportExport/locations'} + + def get( + self, location_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Location or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storageimportexport.models.Location or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Location', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.ImportExport/locations/{locationName}'} diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_operations.py new file mode 100644 index 000000000000..acf63188630d --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/operations/_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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Specifies the API version to use for this request. Constant value: "2016-11-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-11-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Returns the list of operations supported by the import/export resource + provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.storageimportexport.models.OperationPaged[~azure.mgmt.storageimportexport.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ImportExport/operations'} diff --git a/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/version.py b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/azure/mgmt/storageimportexport/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/sdk/storage/azure-mgmt-storageimportexport/sdk_packaging.toml b/sdk/storage/azure-mgmt-storageimportexport/sdk_packaging.toml new file mode 100644 index 000000000000..d07136cd2221 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-storageimportexport" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "StorageImportExport Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/storage/azure-mgmt-storageimportexport/setup.cfg b/sdk/storage/azure-mgmt-storageimportexport/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/storage/azure-mgmt-storageimportexport/setup.py b/sdk/storage/azure-mgmt-storageimportexport/setup.py new file mode 100644 index 000000000000..fd025b2f0c65 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/setup.py @@ -0,0 +1,88 @@ +#!/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. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-storageimportexport" +PACKAGE_PPRINT_NAME = "StorageImportExport Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/storage/azure-mgmt-storageimportexport/tests/recordings/test_cli_mgmt_storageimportexport.test_storageimportexport.yaml b/sdk/storage/azure-mgmt-storageimportexport/tests/recordings/test_cli_mgmt_storageimportexport.test_storageimportexport.yaml new file mode 100644 index 000000000000..09eac37f543a --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/tests/recordings/test_cli_mgmt_storageimportexport.test_storageimportexport.yaml @@ -0,0 +1,247 @@ +interactions: +- request: + body: 'b''b\''b\\\''{"location": "West US", "properties": {"storageAccountId": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.Storage/storageAccounts/gentest", + "jobType": "Import", "returnAddress": {"recipientName": "Tets", "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": "9CA995AA", + "bitLockerKey": "238810-662376-448998-450120-652806-203390-606320-483076", "manifestFile": + "\\\\\\\\\\\\\\\\DriveManifest.xml", "manifestHash": "109B21108597EF36D5785F08303F3638", + "driveHeaderHash": ""}]}}\\\''\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '842' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-storageimportexport/0.1.0 Azure-SDK-For-Python + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.Storage/storageAccounts/gentest","jobType":"Import","returnAddress":{"recipientName":"Tets","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":"9CA995AA","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob","name":"myJob","type":"Microsoft.ImportExport/jobs","location":"West + US"}' + headers: + cache-control: + - no-cache + content-length: + - '1378' + content-type: + - application/json + date: + - Sat, 11 Apr 2020 11:00:25 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 + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-storageimportexport/0.1.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.Storage/storageAccounts/gentest","jobType":"Import","returnAddress":{"recipientName":"Tets","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":"9CA995AA","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob","name":"myJob","type":"Microsoft.ImportExport/jobs","location":"West + US"}' + headers: + cache-control: + - no-cache + content-length: + - '1378' + content-type: + - application/json + date: + - Sat, 11 Apr 2020 11:00:26 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 + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-storageimportexport/0.1.0 Azure-SDK-For-Python + method: GET + uri: https://management.azure.com/providers/Microsoft.ImportExport/locations/eastus?api-version=2016-11-01 + response: + body: + string: '{"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"}' + headers: + cache-control: + - no-cache + content-length: + - '480' + content-type: + - application/json + date: + - Sat, 11 Apr 2020 11:00:28 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": {"state": ""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '29' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-storageimportexport/0.1.0 Azure-SDK-For-Python + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob?api-version=2016-11-01 + response: + body: + string: '{"properties":{"storageAccountId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.Storage/storageAccounts/gentest","jobType":"Import","returnAddress":{"recipientName":"Tets","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":"9CA995AA","manifestFile":"\\DriveManifest.xml","manifestHash":"109B21108597EF36D5785F08303F3638","driveHeaderHash":"","state":"Specified"}],"provisioningState":"Succeeded","encryptionKey":{"kekType":"MicrosoftManaged"}},"identity":{"type":"None"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob","name":"myJob","type":"Microsoft.ImportExport/jobs","location":"West + US"}' + headers: + cache-control: + - no-cache + content-length: + - '1378' + content-type: + - application/json + date: + - Sat, 11 Apr 2020 11:00:29 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 + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-storageimportexport/0.1.0 Azure-SDK-For-Python + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_storageimportexport_test_storageimportexportcdb9187c/providers/Microsoft.ImportExport/jobs/myJob?api-version=2016-11-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sat, 11 Apr 2020 11:00:31 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/sdk/storage/azure-mgmt-storageimportexport/tests/test_cli_mgmt_storageimportexport.py b/sdk/storage/azure-mgmt-storageimportexport/tests/test_cli_mgmt_storageimportexport.py new file mode 100644 index 000000000000..dead3608f762 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/tests/test_cli_mgmt_storageimportexport.py @@ -0,0 +1,112 @@ +# 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. +#-------------------------------------------------------------------------- + + +# TEST SCENARIO COVERAGE +# ---------------------- +# Methods Total : 10 +# Methods Covered : 10 +# Examples Total : 10 +# Examples Tested : 9 +# Coverage % : 90 +# ---------------------- + +import unittest + +import azure.mgmt.storageimportexport +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer, StorageAccountPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtStorageImportExportTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtStorageImportExportTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.storageimportexport.StorageImportExport + ) + + @ResourceGroupPreparer(location=AZURE_LOCATION) + @StorageAccountPreparer(location=AZURE_LOCATION, name_prefix='gentest') + def test_storageimportexport(self, resource_group, storage_account): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + RESOURCE_GROUP = resource_group.name + STORAGE_ACCOUNT_NAME = storage_account.name + JOB_NAME = "myJob" + LOCATION_NAME = "eastus" + + # /Jobs/put/Create job[put] + BODY = { + "location": "West US", + "properties": { + "storage_account_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Storage/storageAccounts/" + STORAGE_ACCOUNT_NAME + "", + "job_type": "Import", + "return_address": { + "recipient_name": "Tets", + "street_address1": "Street1", + "street_address2": "street2", + "city": "Redmond", + "state_or_province": "wa", + "postal_code": "98007", + "country_or_region": "USA", + "phone": "4250000000", + "email": "Test@contoso.com" + }, + "diagnostics_path": "waimportexport", + "log_level": "Verbose", + "backup_drive_manifest": True, + "drive_list": [ + { + "drive_id": "9CA995AA", + "bit_locker_key": "238810-662376-448998-450120-652806-203390-606320-483076", + "manifest_file": "\\DriveManifest.xml", + "manifest_hash": "109B21108597EF36D5785F08303F3638", + "drive_header_hash": "" + } + ] + } + } + result = self.mgmt_client.jobs.create(resource_group_name=RESOURCE_GROUP, job_name=JOB_NAME, body=BODY) + + # /Jobs/get/Get job[get] + result = self.mgmt_client.jobs.get(resource_group_name=RESOURCE_GROUP, job_name=JOB_NAME) + + # /Locations/get/Get locations[get] + result = self.mgmt_client.locations.get(location_name=LOCATION_NAME) + + # /BitLockerKeys/post/List BitLocker Keys for drives in a job[post] + BODY = {} + result = self.mgmt_client.bit_locker_keys.list(resource_group_name=RESOURCE_GROUP, job_name=JOB_NAME, body=BODY) + + # /Jobs/get/List jobs in a resource group[get] + result = self.mgmt_client.jobs.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + + # /Jobs/get/List jobs in a subscription[get] + result = self.mgmt_client.jobs.list_by_subscription() + + # /Locations/get/List locations[get] + result = self.mgmt_client.locations.list() + + # /Jobs/patch/Update job[patch] + BODY = { + "properties": { + "state": "", + "log_level": "Verbose", + "backup_drive_manifest": True + } + } + result = self.mgmt_client.jobs.update(resource_group_name=RESOURCE_GROUP, job_name=JOB_NAME, body=BODY) + + # /Jobs/delete/Delete job[delete] + result = self.mgmt_client.jobs.delete(resource_group_name=RESOURCE_GROUP, job_name=JOB_NAME) + + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 5a4bc65bf05e..19673db8237a 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -59,3 +59,5 @@ stages: safeName: azuremgmtstoragecache - name: azure_mgmt_storagesync safeName: azuremgmtstoragesync + - name: azure_mgmt_storageimportexport + safeName: azuremgmtstorageimportexport