diff --git a/sdk/databox/azure-mgmt-databox/_meta.json b/sdk/databox/azure-mgmt-databox/_meta.json index f61cee449bfe..1f3c3bd4f7ae 100644 --- a/sdk/databox/azure-mgmt-databox/_meta.json +++ b/sdk/databox/azure-mgmt-databox/_meta.json @@ -1,11 +1,11 @@ { - "commit": "6e70667577cfb7bc194785683ca591b95abd524c", + "commit": "5d31f53fbd070705e63e349221d291df3c33ac10", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.6", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.6.0", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/databox/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/databox/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.6.0 --use=@autorest/modelerfour@4.26.2 --version=3.9.6 --version-tolerant=False", "readme": "specification/databox/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py index b8236d53f569..5e19eef742a2 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_data_box_management_client.py @@ -54,7 +54,7 @@ class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-12-01' + DEFAULT_API_VERSION = '2023-03-01' _PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxManagementClient, self).__init__( @@ -99,6 +101,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2022-10-01: :mod:`v2022_10_01.models` * 2022-12-01: :mod:`v2022_12_01.models` + * 2023-03-01: :mod:`v2023_03_01.models` """ if api_version == '2018-01-01': from .v2018_01_01 import models @@ -136,6 +139,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-12-01': from .v2022_12_01 import models return models + elif api_version == '2023-03-01': + from .v2023_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -154,6 +160,7 @@ def jobs(self): * 2022-09-01: :class:`JobsOperations` * 2022-10-01: :class:`JobsOperations` * 2022-12-01: :class:`JobsOperations` + * 2023-03-01: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') if api_version == '2018-01-01': @@ -180,10 +187,12 @@ def jobs(self): from .v2022_10_01.operations import JobsOperations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import JobsOperations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import JobsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -201,6 +210,7 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2022-10-01: :class:`Operations` * 2022-12-01: :class:`Operations` + * 2023-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-01-01': @@ -227,10 +237,12 @@ def operations(self): from .v2022_10_01.operations import Operations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import Operations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def service(self): @@ -248,6 +260,7 @@ def service(self): * 2022-09-01: :class:`ServiceOperations` * 2022-10-01: :class:`ServiceOperations` * 2022-12-01: :class:`ServiceOperations` + * 2023-03-01: :class:`ServiceOperations` """ api_version = self._get_api_version('service') if api_version == '2018-01-01': @@ -274,10 +287,12 @@ def service(self): from .v2022_10_01.operations import ServiceOperations as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import ServiceOperations as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import ServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py index 44671cbe3044..88f8617cb165 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, IO, Optional, Union from . import models as _models @@ -33,7 +34,7 @@ def mitigate( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO type. Required. - :type mitigate_job_request: ~azure.mgmt.databox.v2022_12_01.models.MitigateJobRequest or IO + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -59,6 +60,8 @@ def mitigate( # pylint: disable=inconsistent-return-statements from .v2022_10_01.operations import DataBoxManagementClientOperationsMixin as OperationClass elif api_version == '2022-12-01': from .v2022_12_01.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-03-01': + from .v2023_03_01.operations import DataBoxManagementClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'mitigate'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_version.py index 88729157c488..a30a458f8b5b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "0.1.0" \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py index 60d1797efcd3..08fde03df748 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_data_box_management_client.py @@ -54,7 +54,7 @@ class DataBoxManagementClient(DataBoxManagementClientOperationsMixin, MultiApiCl :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-12-01' + DEFAULT_API_VERSION = '2023-03-01' _PROFILE_TAG = "azure.mgmt.databox.DataBoxManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -72,6 +72,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = DataBoxManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(DataBoxManagementClient, self).__init__( @@ -99,6 +101,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2022-10-01: :mod:`v2022_10_01.models` * 2022-12-01: :mod:`v2022_12_01.models` + * 2023-03-01: :mod:`v2023_03_01.models` """ if api_version == '2018-01-01': from ..v2018_01_01 import models @@ -136,6 +139,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-12-01': from ..v2022_12_01 import models return models + elif api_version == '2023-03-01': + from ..v2023_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -154,6 +160,7 @@ def jobs(self): * 2022-09-01: :class:`JobsOperations` * 2022-10-01: :class:`JobsOperations` * 2022-12-01: :class:`JobsOperations` + * 2023-03-01: :class:`JobsOperations` """ api_version = self._get_api_version('jobs') if api_version == '2018-01-01': @@ -180,10 +187,12 @@ def jobs(self): from ..v2022_10_01.aio.operations import JobsOperations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import JobsOperations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import JobsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jobs'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -201,6 +210,7 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2022-10-01: :class:`Operations` * 2022-12-01: :class:`Operations` + * 2023-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-01-01': @@ -227,10 +237,12 @@ def operations(self): from ..v2022_10_01.aio.operations import Operations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import Operations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def service(self): @@ -248,6 +260,7 @@ def service(self): * 2022-09-01: :class:`ServiceOperations` * 2022-10-01: :class:`ServiceOperations` * 2022-12-01: :class:`ServiceOperations` + * 2023-03-01: :class:`ServiceOperations` """ api_version = self._get_api_version('service') if api_version == '2018-01-01': @@ -274,10 +287,12 @@ def service(self): from ..v2022_10_01.aio.operations import ServiceOperations as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import ServiceOperations as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import ServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py index 26d6fadd95cf..c882d0a76112 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/aio/_operations_mixin.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- from .._serialization import Serializer, Deserializer +from io import IOBase from typing import Any, IO, Optional, Union from .. import models as _models @@ -33,7 +34,7 @@ async def mitigate( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO type. Required. - :type mitigate_job_request: ~azure.mgmt.databox.v2022_12_01.models.MitigateJobRequest or IO + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -59,6 +60,8 @@ async def mitigate( # pylint: disable=inconsistent-return-statements from ..v2022_10_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass elif api_version == '2022-12-01': from ..v2022_12_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass + elif api_version == '2023-03-01': + from ..v2023_03_01.aio.operations import DataBoxManagementClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'mitigate'".format(api_version)) mixin_instance = OperationClass() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py index 9b63e14258de..9c19a9e0294e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2022_12_01.models import * +from .v2023_03_01.models import * diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py index ed1e190b9410..64447c9e309e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py index 27aa34f1eed3..748748093a2b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2018-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py index 10b7ebc0d07a..dd07a079f1bd 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -170,7 +172,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -273,7 +275,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -325,14 +327,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -487,7 +489,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -546,7 +548,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -604,7 +606,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -663,14 +665,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -841,7 +843,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -984,14 +986,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1129,14 +1131,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1196,7 +1198,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py index 81f998c57982..c4c379337f30 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py index 8f22e7c3c5f3..5096ff75960e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -121,7 +123,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -135,7 +137,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -276,14 +278,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py index efadbc3db7c6..533a9c153fe8 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -332,6 +333,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -348,7 +350,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -436,7 +438,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -539,7 +541,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -591,14 +593,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -753,7 +755,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -812,7 +814,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -870,7 +872,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -929,14 +931,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1107,7 +1109,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1250,14 +1252,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1395,14 +1397,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1462,7 +1464,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py index a16fe63d2dfc..d01718ad4492 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py index cf3b808cee12..e6e95b3843f6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2018_01_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -115,6 +116,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -181,7 +183,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -195,7 +197,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -336,14 +338,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py index 64cbdaa4001f..9e6da4f27d92 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py index 6ecd302a97e3..f3fab9f09502 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2019-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py index 0f8581a0c298..0220fffdb42b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -170,7 +172,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -273,7 +275,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -325,14 +327,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -487,7 +489,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -546,7 +548,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -604,7 +606,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -663,14 +665,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -841,7 +843,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -984,14 +986,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1129,14 +1131,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1196,7 +1198,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py index d205d75717f7..7cdfaf525106 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py index 3304f5c45bdd..e33fd4bd1852 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -128,7 +130,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -142,7 +144,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -298,7 +300,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -312,7 +314,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -457,14 +459,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -595,14 +597,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -717,14 +719,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -842,14 +844,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py index c36c15bdc8a4..afe5f15b5a3b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -445,7 +447,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -548,7 +550,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -600,14 +602,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -762,7 +764,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -821,7 +823,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -879,7 +881,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -938,14 +940,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1116,7 +1118,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1259,14 +1261,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1404,14 +1406,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1471,7 +1473,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py index 7dd09d7e3cf1..99e597c77dff 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py index 583c0b444d58..a4a87f681c37 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -66,7 +67,7 @@ def build_list_available_skus_request(location: str, subscription_id: str, **kwa return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -131,7 +132,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -245,6 +246,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus( @@ -311,7 +313,7 @@ def list_available_skus( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -325,7 +327,7 @@ def list_available_skus( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -478,7 +480,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -492,7 +494,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -637,14 +639,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -775,14 +777,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -897,14 +899,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -1022,14 +1024,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py index 5cf52ec91103..3b07cfcd8739 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py index cf68687a0459..5bd4e9fe8c40 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-04-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py index eef4cd4a9d9e..b14554e6aafa 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -171,7 +173,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -275,7 +277,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -328,14 +330,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -491,7 +493,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,7 +611,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -668,14 +670,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -847,7 +849,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -990,14 +992,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1136,14 +1138,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1204,7 +1206,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py index 186ed5d0fd28..2a1ae258fb2a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py index e3ec2fd1edeb..46205c1b3b74 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -148,7 +150,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -162,7 +164,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -308,14 +310,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -447,14 +449,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -570,14 +572,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -699,14 +701,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -845,14 +847,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py index ba14152b714a..0b0753519ab4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py index 5b9ea9da5eba..a6eef976ba00 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py index 8a54dd5c2818..0d0bba970894 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_04_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py index f497599a751b..f742e06fe5a5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py index 7dde29730a9f..ae2165b137d5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/_data_box_management_client.py @@ -60,9 +60,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2020-11-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py index f2df0c31914a..82822efce7f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -81,7 +83,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -171,7 +173,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -275,7 +277,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -328,14 +330,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -491,7 +493,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -550,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -609,7 +611,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -668,14 +670,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -847,7 +849,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -990,14 +992,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1136,14 +1138,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1204,7 +1206,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py index a7a98689f79c..2ecc07ef01f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py index c05e68254e8b..c106a8e6b2e4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -148,7 +150,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -162,7 +164,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -308,14 +310,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -447,14 +449,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -570,14 +572,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -699,14 +701,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -845,14 +847,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py index 7d0e7750608a..53ff245cc4c0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py index cbe9a98b454d..3c1c4d2ca3c5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py index 9a3179c2ce5d..a97cbc5089d5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2020_11_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py index bcfa59dcd828..8306dec14e0a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json index 0ae7fe8ee06b..6ce10b8bac28 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py index b4ef1b3148ed..56fec44405a7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py index df68c5af7282..38437920ae10 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-03-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py index e91ad4ac279f..0300e958a52c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -82,7 +84,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -172,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -276,7 +278,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -329,14 +331,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -492,7 +494,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -551,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -610,7 +612,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -669,14 +671,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -848,7 +850,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -991,14 +993,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1137,14 +1139,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1205,7 +1207,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py index 4dd8b9d246e0..6c46f9d0a93b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py index a92d389ee394..8fe6a2af603a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py index 64c601a9ad1f..f1d38904e348 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-03-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py index 009bbb92024c..e2053777d1f6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py index 58cacc55eec4..d08e5a438cdf 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py index 1f746c6fc445..188bfe2976d7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_03_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py index c2a21d5ea0e8..b5cfb66e881a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json index a11ff6d73786..e8521eb86417 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py index c0384889553e..1918e1eb4173 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py index d5702ee6beeb..fababcde6126 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-05-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py index 7f2a6d7885ad..30b8de32a063 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -82,7 +84,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -172,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -276,7 +278,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -329,14 +331,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -492,7 +494,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -551,7 +553,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -610,7 +612,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -669,14 +671,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -848,7 +850,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -991,14 +993,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1137,14 +1139,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1205,7 +1207,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py index 7cb78def255c..68cb7fb54d2c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py index 17cfa434d4a1..e80199eb7aad 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py index 57894b14f443..d41e900d3089 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-05-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py index 42661ab49d20..e7701ac5df36 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -341,6 +342,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -357,7 +359,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -446,7 +448,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -550,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -603,14 +605,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -766,7 +768,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -825,7 +827,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -884,7 +886,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -943,14 +945,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1122,7 +1124,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1265,14 +1267,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1411,14 +1413,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1479,7 +1481,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py index 3fa30b00bee2..6af3c4e763ad 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py index 44b1fc10bee6..c2703f846899 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_05_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py index 1780310bb86d..d4409cdfd6a9 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_data_box_management_client.py @@ -62,9 +62,13 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json index 723bb3551693..90f2bce9ad02 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py index f9a3b3896ae9..db045aa7cf37 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/_data_box_management_client.py @@ -62,9 +62,13 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview") + self.service = ServiceOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-08-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py index dd6395df7fcf..4e0e5e05939c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -130,14 +137,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py index be495fac17ef..b25cc86b63c4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,9 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +255,16 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +323,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +429,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +484,16 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -640,7 +652,9 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -699,7 +713,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -758,7 +774,9 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -817,14 +835,16 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -999,7 +1019,9 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1143,14 +1165,16 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1314,16 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1384,9 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py index 981c903171ac..d5127e411b26 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py index 65d2e11b60ac..7613041d8221 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -150,7 +152,9 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -164,7 +168,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -310,14 +314,16 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -450,14 +456,16 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -574,14 +582,16 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -703,14 +713,16 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -849,14 +861,16 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py index 7d071802c658..d948ce61cc86 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -164,14 +171,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py index c10c8d5b9a2f..6dad14edc7ba 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -392,7 +394,9 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -560,14 +564,16 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -626,7 +632,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -730,7 +738,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -783,14 +793,16 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -949,7 +961,9 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1008,7 +1022,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1067,7 +1083,9 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1126,14 +1144,16 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1328,9 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1452,14 +1474,16 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1599,14 +1623,16 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1667,7 +1693,9 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py index 698998454f77..e2bf4d79d7ab 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py index 5b42d1f7408f..678081cdf6fa 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_08_01_preview/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -339,7 +341,9 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -353,7 +357,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -499,14 +503,16 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -639,14 +645,16 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -763,14 +771,16 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -892,14 +902,16 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1038,14 +1050,16 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py index 7fbf42ad5361..a13d81c6351f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json index 9be4f502274b..5253cd8b10c0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py index a0e045602b21..6152927dc35f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2021-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py index 5576f92363e2..fe11c094d347 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py index ca448438ed6c..d51180270941 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -755,7 +757,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -814,14 +816,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -993,7 +995,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1136,14 +1138,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1282,14 +1284,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1350,7 +1352,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py index 123f2db390eb..420e21944fe5 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py index d201b7bd09e4..1b65211ff248 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py index 4a7112748091..6b5adbfdbd82 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2021-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py index a9ea33461aeb..e30cb4dc9daa 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1062,7 +1064,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1121,14 +1123,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1300,7 +1302,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1443,14 +1445,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1589,14 +1591,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1657,7 +1659,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py index 4480beae538b..666f199fab6c 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py index 4ca7ca0528aa..eeb7b864bb74 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2021_12_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py index 672108e0a0f5..64ac6320f190 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json index 6ea2711f5443..bc5a4c1048c1 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py index 93a6c5fa4f40..d38dd558d80a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-02-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py index 98224f67df95..8d59164bcc29 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-02-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py index e335e4040a6d..ef12750bdd26 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -755,7 +757,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -814,14 +816,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -993,7 +995,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1136,14 +1138,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1282,14 +1284,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1350,7 +1352,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py index 5ca5b405a9db..f653ebf468e9 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py index 2b79c20ec4fe..67cf318b7b09 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py index 459ae9506465..6c10e13021b6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-02-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py index af4d660d9695..415716382c96 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1062,7 +1064,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1121,14 +1123,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1300,7 +1302,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1443,14 +1445,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1589,14 +1591,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1657,7 +1659,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py index 75612938ade1..634de61ad99a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py index 1abb0c2b10be..62c808ad2dd4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_02_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py index 12a9ae472094..b83f51600fe1 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json index 879373027b55..5b010b121a2f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py index c58d4a2be848..f9a2f9f0543a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-09-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py index e489342faa0d..6c21245cb2d7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-09-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py index 31e4d866e35f..65efcb311a7a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py index d768d9798c7e..06cb565f542b 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py index ee5e433f777a..280c78ab3c5f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py index 0c2e090e360e..6bcc3b5d21ad 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-09-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py index 2a1797e21393..5cf9a0bac413 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py index 1620898f063d..461e98d32370 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py index 164144b481a0..bc31d959cfbe 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_09_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py index abb0bfd77611..68aaaa401928 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json index b67476eb5fa4..7f5a6e0deceb 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py index 157f92f3a74b..5a817e4fcd17 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-10-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py index 1db8b41616e1..3f651cff3d85 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-10-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py index 154830720520..8931f017832e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py index 3d00fb6aebb0..8a135190aea6 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py index ac82c2c62441..1c32619d0d0f 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py index 2341c336899a..69107f4c88ab 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-10-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py index 097793c05056..6ce9a98f0f30 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py index acde6931fb82..49e9804f083d 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py index c189abb657b1..4e1578d7edaa 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_10_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py index 91fe025a43d1..914b9d7083f7 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json index 5589f7f180c3..6d59eeeb5384 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_metadata.json @@ -110,8 +110,8 @@ "service": "ServiceOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py index 34416e5ebff4..c25eab0db2ba 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/_data_box_management_client.py @@ -62,9 +62,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2022-12-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py index 143079f74210..eb03bf8d254e 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,12 @@ class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload async def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -129,14 +136,16 @@ async def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py index 2c1a7efc5c42..f8f24f83e7f4 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: @@ -83,7 +85,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -251,14 +253,14 @@ async def mark_devices_shipped( # pylint: disable=inconsistent-return-statement _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -317,7 +319,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -421,7 +423,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -474,14 +476,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -637,7 +639,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -696,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -759,7 +761,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -818,14 +820,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1001,7 +1003,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1144,14 +1146,14 @@ async def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1290,14 +1292,14 @@ async def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1358,7 +1360,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py index d5b3d10d4b36..1cb66801a8e0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py index aa4b6a937c05..003955b11dc0 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/aio/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -60,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -149,7 +151,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -163,7 +165,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -309,14 +311,14 @@ async def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -448,14 +450,14 @@ async def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -571,14 +573,14 @@ async def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -700,14 +702,14 @@ async def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -846,14 +848,14 @@ async def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py index bcbc02eab000..847649e0cb7a 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_data_box_management_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -67,6 +68,12 @@ def build_mitigate_request(job_name: str, resource_group_name: str, subscription class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + @overload def mitigate( # pylint: disable=inconsistent-return-statements self, @@ -163,14 +170,16 @@ def mitigate( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2022-12-01") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mitigate_job_request, (IO, bytes)): + if isinstance(mitigate_job_request, (IOBase, bytes)): _content = mitigate_job_request else: _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py index 3300801ba281..bfce45b0b578 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -375,6 +376,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: @@ -391,7 +393,7 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -559,14 +561,14 @@ def mark_devices_shipped( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(mark_devices_shipped_request, (IO, bytes)): + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): _content = mark_devices_shipped_request else: _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") @@ -624,7 +626,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { @@ -728,7 +730,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( @@ -781,14 +783,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource, (IO, bytes)): + if isinstance(job_resource, (IOBase, bytes)): _content = job_resource else: _json = self._serialize.body(job_resource, "JobResource") @@ -944,7 +946,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1003,7 +1005,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1066,7 +1068,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1125,14 +1127,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(job_resource_update_parameter, (IO, bytes)): + if isinstance(job_resource_update_parameter, (IOBase, bytes)): _content = job_resource_update_parameter else: _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") @@ -1308,7 +1310,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1451,14 +1453,14 @@ def book_shipment_pick_up( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(shipment_pick_up_request, (IO, bytes)): + if isinstance(shipment_pick_up_request, (IOBase, bytes)): _content = shipment_pick_up_request else: _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") @@ -1597,14 +1599,14 @@ def cancel( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cancellation_reason, (IO, bytes)): + if isinstance(cancellation_reason, (IOBase, bytes)): _content = cancellation_reason else: _json = self._serialize.body(cancellation_reason, "CancellationReason") @@ -1665,7 +1667,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py index 5800edfae7bb..66375851ee07 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_operations.py @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py index a50ea56fee4d..7029edb6e650 100644 --- a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2022_12_01/operations/_service_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -36,7 +37,7 @@ _SERIALIZER.client_side_validation = False -def build_list_available_skus_by_resource_group_request( # pylint: disable=name-too-long +def build_list_available_skus_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -101,7 +102,7 @@ def build_validate_address_request(location: str, subscription_id: str, **kwargs return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_inputs_by_resource_group_request( # pylint: disable=name-too-long +def build_validate_inputs_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -197,7 +198,7 @@ def build_region_configuration_request(location: str, subscription_id: str, **kw return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_region_configuration_by_resource_group_request( # pylint: disable=name-too-long +def build_region_configuration_by_resource_group_request( resource_group_name: str, location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -249,6 +250,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def list_available_skus_by_resource_group( @@ -335,7 +337,7 @@ def list_available_skus_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) @@ -349,7 +351,7 @@ def list_available_skus_by_resource_group( content_type = content_type or "application/json" _json = None _content = None - if isinstance(available_sku_request, (IO, bytes)): + if isinstance(available_sku_request, (IOBase, bytes)): _content = available_sku_request else: _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") @@ -495,14 +497,14 @@ def validate_address( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_address, (IO, bytes)): + if isinstance(validate_address, (IOBase, bytes)): _content = validate_address else: _json = self._serialize.body(validate_address, "ValidateAddress") @@ -634,14 +636,14 @@ def validate_inputs_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -757,14 +759,14 @@ def validate_inputs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validation_request, (IO, bytes)): + if isinstance(validation_request, (IOBase, bytes)): _content = validation_request else: _json = self._serialize.body(validation_request, "ValidationRequest") @@ -886,14 +888,14 @@ def region_configuration( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") @@ -1032,14 +1034,14 @@ def region_configuration_by_resource_group( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(region_configuration_request, (IO, bytes)): + if isinstance(region_configuration_request, (IOBase, bytes)): _content = region_configuration_request else: _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py new file mode 100644 index 000000000000..063260fb2814 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/__init__.py @@ -0,0 +1,26 @@ +# 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 ._data_box_management_client import DataBoxManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.py new file mode 100644 index 000000000000..03bb837d6c53 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_configuration.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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-03-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py new file mode 100644 index 000000000000..96bdf94320a7 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_data_box_management_client.py @@ -0,0 +1,99 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_03_01.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_03_01.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_03_01.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "DataBoxManagementClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json new file mode 100644 index 000000000000..813f70e6f4a8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_metadata.json @@ -0,0 +1,133 @@ +{ + "chosen_version": "2023-03-01", + "total_api_version_list": ["2023-03-01"], + "client": { + "name": "DataBoxManagementClient", + "filename": "_data_box_management_client", + "description": "The DataBox Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoxManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"DataBoxManagementClientOperationsMixin\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Subscription Id. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version: Optional[str]=None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "jobs": "JobsOperations", + "service": "ServiceOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"stdlib\": {\"typing\": [\"IO\", \"Optional\", \"Union\"], \"io\": [\"IOBase\"]}}}", + "sync_mixin_typing_definitions": "", + "async_mixin_typing_definitions": "", + "operations": { + "mitigate" : { + "sync": { + "signature": "def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + }, + "async": { + "coroutine": true, + "signature": "async def mitigate( # pylint: disable=inconsistent-return-statements\n self,\n job_name: str,\n resource_group_name: str,\n mitigate_job_request: Union[_models.MitigateJobRequest, IO],\n **kwargs: Any\n) -\u003e None:\n", + "doc": "\"\"\"Request to mitigate for a given job.\n\n:param job_name: The name of the job Resource within the specified resource group. job names\n must be between 3 and 24 characters in length and use any alphanumeric and underscore only.\n Required.\n:type job_name: str\n:param resource_group_name: The Resource Group Name. Required.\n:type resource_group_name: str\n:param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO\n type. Required.\n:type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", + "call": "job_name, resource_group_name, mitigate_job_request, **kwargs" + } + } + } + } +} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py new file mode 100644 index 000000000000..ec8d8f6dd7b4 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_vendor.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import List, TYPE_CHECKING, cast + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.py new file mode 100644 index 000000000000..955dbd6c6677 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/__init__.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 ._data_box_management_client import DataBoxManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DataBoxManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.py new file mode 100644 index 000000000000..46a49bad20af --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_configuration.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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DataBoxManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(DataBoxManagementClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-03-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-databox/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py new file mode 100644 index 000000000000..1cabfa5a53c6 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_data_box_management_client.py @@ -0,0 +1,99 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import DataBoxManagementClientConfiguration +from .operations import DataBoxManagementClientOperationsMixin, JobsOperations, Operations, ServiceOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DataBoxManagementClient( + DataBoxManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword + """The DataBox Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.databox.v2023_03_01.aio.operations.Operations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.databox.v2023_03_01.aio.operations.JobsOperations + :ivar service: ServiceOperations operations + :vartype service: azure.mgmt.databox.v2023_03_01.aio.operations.ServiceOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Subscription Id. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DataBoxManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01") + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DataBoxManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py new file mode 100644 index 000000000000..54f3d3ec6541 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import DataBoxManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class DataBoxManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: DataBoxManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..9a9f48e22fa1 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_data_box_management_client_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_box_management_client_operations import build_mitigate_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-03-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py new file mode 100644 index 000000000000..8382f0674699 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_jobs_operations.py @@ -0,0 +1,1434 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._jobs_operations import ( + build_book_shipment_pick_up_request, + build_cancel_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_credentials_request, + build_list_request, + build_mark_devices_shipped_request, + build_update_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + async def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UnencryptedCredentialsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py new file mode 100644 index 000000000000..b3df02152871 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py new file mode 100644 index 000000000000..0ee6af375b78 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/aio/operations/_service_operations.py @@ -0,0 +1,899 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_operations import ( + build_list_available_skus_by_resource_group_request, + build_region_configuration_by_resource_group_request, + build_region_configuration_request, + build_validate_address_request, + build_validate_inputs_by_resource_group_request, + build_validate_inputs_request, +) +from .._vendor import DataBoxManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.aio.DataBoxManagementClient`'s + :attr:`service` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> AsyncIterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableSkusResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + async def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + async def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py new file mode 100644 index 000000000000..3eb7624e41b8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/__init__.py @@ -0,0 +1,331 @@ +# 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 ._models_py3 import AccountCredentialDetails +from ._models_py3 import AdditionalErrorInfo +from ._models_py3 import AddressValidationOutput +from ._models_py3 import AddressValidationProperties +from ._models_py3 import ApiError +from ._models_py3 import ApplianceNetworkConfiguration +from ._models_py3 import ArmBaseObject +from ._models_py3 import AvailableSkuRequest +from ._models_py3 import AvailableSkusResult +from ._models_py3 import AzureFileFilterDetails +from ._models_py3 import BlobFilterDetails +from ._models_py3 import CancellationReason +from ._models_py3 import CloudError +from ._models_py3 import ContactDetails +from ._models_py3 import ContactInfo +from ._models_py3 import CopyLogDetails +from ._models_py3 import CopyProgress +from ._models_py3 import CreateJobValidations +from ._models_py3 import CreateOrderLimitForSubscriptionValidationRequest +from ._models_py3 import CreateOrderLimitForSubscriptionValidationResponseProperties +from ._models_py3 import CustomerDiskJobSecrets +from ._models_py3 import DataAccountDetails +from ._models_py3 import DataBoxAccountCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyLogDetails +from ._models_py3 import DataBoxCustomerDiskCopyProgress +from ._models_py3 import DataBoxCustomerDiskJobDetails +from ._models_py3 import DataBoxDiskCopyLogDetails +from ._models_py3 import DataBoxDiskCopyProgress +from ._models_py3 import DataBoxDiskGranularCopyLogDetails +from ._models_py3 import DataBoxDiskGranularCopyProgress +from ._models_py3 import DataBoxDiskJobDetails +from ._models_py3 import DataBoxDiskJobSecrets +from ._models_py3 import DataBoxHeavyAccountCopyLogDetails +from ._models_py3 import DataBoxHeavyJobDetails +from ._models_py3 import DataBoxHeavyJobSecrets +from ._models_py3 import DataBoxHeavySecret +from ._models_py3 import DataBoxJobDetails +from ._models_py3 import DataBoxScheduleAvailabilityRequest +from ._models_py3 import DataBoxSecret +from ._models_py3 import DataExportDetails +from ._models_py3 import DataImportDetails +from ._models_py3 import DataLocationToServiceLocationMap +from ._models_py3 import DataTransferDetailsValidationRequest +from ._models_py3 import DataTransferDetailsValidationResponseProperties +from ._models_py3 import DataboxJobSecrets +from ._models_py3 import DatacenterAddressInstructionResponse +from ._models_py3 import DatacenterAddressLocationResponse +from ._models_py3 import DatacenterAddressRequest +from ._models_py3 import DatacenterAddressResponse +from ._models_py3 import DcAccessSecurityCode +from ._models_py3 import Details +from ._models_py3 import DeviceErasureDetails +from ._models_py3 import DiskScheduleAvailabilityRequest +from ._models_py3 import DiskSecret +from ._models_py3 import EncryptionPreferences +from ._models_py3 import ErrorDetail +from ._models_py3 import ExportDiskDetails +from ._models_py3 import FilterFileDetails +from ._models_py3 import GranularCopyLogDetails +from ._models_py3 import GranularCopyProgress +from ._models_py3 import HeavyScheduleAvailabilityRequest +from ._models_py3 import IdentityProperties +from ._models_py3 import ImportDiskDetails +from ._models_py3 import JobDelayDetails +from ._models_py3 import JobDeliveryInfo +from ._models_py3 import JobDetails +from ._models_py3 import JobResource +from ._models_py3 import JobResourceList +from ._models_py3 import JobResourceUpdateParameter +from ._models_py3 import JobSecrets +from ._models_py3 import JobStages +from ._models_py3 import KeyEncryptionKey +from ._models_py3 import LastMitigationActionOnJob +from ._models_py3 import ManagedDiskDetails +from ._models_py3 import MarkDevicesShippedRequest +from ._models_py3 import MitigateJobRequest +from ._models_py3 import NotificationPreference +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import PackageCarrierDetails +from ._models_py3 import PackageCarrierInfo +from ._models_py3 import PackageShippingDetails +from ._models_py3 import Preferences +from ._models_py3 import PreferencesValidationRequest +from ._models_py3 import PreferencesValidationResponseProperties +from ._models_py3 import RegionConfigurationRequest +from ._models_py3 import RegionConfigurationResponse +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import ReverseShippingDetails +from ._models_py3 import ScheduleAvailabilityRequest +from ._models_py3 import ScheduleAvailabilityResponse +from ._models_py3 import ShareCredentialDetails +from ._models_py3 import ShipmentPickUpRequest +from ._models_py3 import ShipmentPickUpResponse +from ._models_py3 import ShippingAddress +from ._models_py3 import Sku +from ._models_py3 import SkuAvailabilityValidationRequest +from ._models_py3 import SkuAvailabilityValidationResponseProperties +from ._models_py3 import SkuCapacity +from ._models_py3 import SkuCost +from ._models_py3 import SkuInformation +from ._models_py3 import StorageAccountDetails +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationRequest +from ._models_py3 import SubscriptionIsAllowedToCreateJobValidationResponseProperties +from ._models_py3 import SystemData +from ._models_py3 import TransferAllDetails +from ._models_py3 import TransferConfiguration +from ._models_py3 import TransferConfigurationTransferAllDetails +from ._models_py3 import TransferConfigurationTransferFilterDetails +from ._models_py3 import TransferFilterDetails +from ._models_py3 import TransportAvailabilityDetails +from ._models_py3 import TransportAvailabilityRequest +from ._models_py3 import TransportAvailabilityResponse +from ._models_py3 import TransportPreferences +from ._models_py3 import UnencryptedCredentials +from ._models_py3 import UnencryptedCredentialsList +from ._models_py3 import UpdateJobDetails +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserAssignedProperties +from ._models_py3 import ValidateAddress +from ._models_py3 import ValidationInputRequest +from ._models_py3 import ValidationInputResponse +from ._models_py3 import ValidationRequest +from ._models_py3 import ValidationResponse + +from ._data_box_management_client_enums import AccessProtocol +from ._data_box_management_client_enums import AddressType +from ._data_box_management_client_enums import AddressValidationStatus +from ._data_box_management_client_enums import ClassDiscriminator +from ._data_box_management_client_enums import CopyStatus +from ._data_box_management_client_enums import CustomerResolutionCode +from ._data_box_management_client_enums import DataAccountType +from ._data_box_management_client_enums import DataCenterCode +from ._data_box_management_client_enums import DatacenterAddressType +from ._data_box_management_client_enums import DelayNotificationStatus +from ._data_box_management_client_enums import DoubleEncryption +from ._data_box_management_client_enums import FilterFileType +from ._data_box_management_client_enums import HardwareEncryption +from ._data_box_management_client_enums import JobDeliveryType +from ._data_box_management_client_enums import KekType +from ._data_box_management_client_enums import LogCollectionLevel +from ._data_box_management_client_enums import NotificationStageName +from ._data_box_management_client_enums import OverallValidationStatus +from ._data_box_management_client_enums import PortalDelayErrorCode +from ._data_box_management_client_enums import ReverseShippingDetailsEditStatus +from ._data_box_management_client_enums import ReverseTransportPreferenceEditStatus +from ._data_box_management_client_enums import ShareDestinationFormatType +from ._data_box_management_client_enums import SkuDisabledReason +from ._data_box_management_client_enums import SkuName +from ._data_box_management_client_enums import StageName +from ._data_box_management_client_enums import StageStatus +from ._data_box_management_client_enums import TransferConfigurationType +from ._data_box_management_client_enums import TransferType +from ._data_box_management_client_enums import TransportShipmentTypes +from ._data_box_management_client_enums import ValidationInputDiscriminator +from ._data_box_management_client_enums import ValidationStatus +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AccountCredentialDetails", + "AdditionalErrorInfo", + "AddressValidationOutput", + "AddressValidationProperties", + "ApiError", + "ApplianceNetworkConfiguration", + "ArmBaseObject", + "AvailableSkuRequest", + "AvailableSkusResult", + "AzureFileFilterDetails", + "BlobFilterDetails", + "CancellationReason", + "CloudError", + "ContactDetails", + "ContactInfo", + "CopyLogDetails", + "CopyProgress", + "CreateJobValidations", + "CreateOrderLimitForSubscriptionValidationRequest", + "CreateOrderLimitForSubscriptionValidationResponseProperties", + "CustomerDiskJobSecrets", + "DataAccountDetails", + "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDiskCopyLogDetails", + "DataBoxCustomerDiskCopyProgress", + "DataBoxCustomerDiskJobDetails", + "DataBoxDiskCopyLogDetails", + "DataBoxDiskCopyProgress", + "DataBoxDiskGranularCopyLogDetails", + "DataBoxDiskGranularCopyProgress", + "DataBoxDiskJobDetails", + "DataBoxDiskJobSecrets", + "DataBoxHeavyAccountCopyLogDetails", + "DataBoxHeavyJobDetails", + "DataBoxHeavyJobSecrets", + "DataBoxHeavySecret", + "DataBoxJobDetails", + "DataBoxScheduleAvailabilityRequest", + "DataBoxSecret", + "DataExportDetails", + "DataImportDetails", + "DataLocationToServiceLocationMap", + "DataTransferDetailsValidationRequest", + "DataTransferDetailsValidationResponseProperties", + "DataboxJobSecrets", + "DatacenterAddressInstructionResponse", + "DatacenterAddressLocationResponse", + "DatacenterAddressRequest", + "DatacenterAddressResponse", + "DcAccessSecurityCode", + "Details", + "DeviceErasureDetails", + "DiskScheduleAvailabilityRequest", + "DiskSecret", + "EncryptionPreferences", + "ErrorDetail", + "ExportDiskDetails", + "FilterFileDetails", + "GranularCopyLogDetails", + "GranularCopyProgress", + "HeavyScheduleAvailabilityRequest", + "IdentityProperties", + "ImportDiskDetails", + "JobDelayDetails", + "JobDeliveryInfo", + "JobDetails", + "JobResource", + "JobResourceList", + "JobResourceUpdateParameter", + "JobSecrets", + "JobStages", + "KeyEncryptionKey", + "LastMitigationActionOnJob", + "ManagedDiskDetails", + "MarkDevicesShippedRequest", + "MitigateJobRequest", + "NotificationPreference", + "Operation", + "OperationDisplay", + "OperationList", + "PackageCarrierDetails", + "PackageCarrierInfo", + "PackageShippingDetails", + "Preferences", + "PreferencesValidationRequest", + "PreferencesValidationResponseProperties", + "RegionConfigurationRequest", + "RegionConfigurationResponse", + "Resource", + "ResourceIdentity", + "ReverseShippingDetails", + "ScheduleAvailabilityRequest", + "ScheduleAvailabilityResponse", + "ShareCredentialDetails", + "ShipmentPickUpRequest", + "ShipmentPickUpResponse", + "ShippingAddress", + "Sku", + "SkuAvailabilityValidationRequest", + "SkuAvailabilityValidationResponseProperties", + "SkuCapacity", + "SkuCost", + "SkuInformation", + "StorageAccountDetails", + "SubscriptionIsAllowedToCreateJobValidationRequest", + "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + "SystemData", + "TransferAllDetails", + "TransferConfiguration", + "TransferConfigurationTransferAllDetails", + "TransferConfigurationTransferFilterDetails", + "TransferFilterDetails", + "TransportAvailabilityDetails", + "TransportAvailabilityRequest", + "TransportAvailabilityResponse", + "TransportPreferences", + "UnencryptedCredentials", + "UnencryptedCredentialsList", + "UpdateJobDetails", + "UserAssignedIdentity", + "UserAssignedProperties", + "ValidateAddress", + "ValidationInputRequest", + "ValidationInputResponse", + "ValidationRequest", + "ValidationResponse", + "AccessProtocol", + "AddressType", + "AddressValidationStatus", + "ClassDiscriminator", + "CopyStatus", + "CustomerResolutionCode", + "DataAccountType", + "DataCenterCode", + "DatacenterAddressType", + "DelayNotificationStatus", + "DoubleEncryption", + "FilterFileType", + "HardwareEncryption", + "JobDeliveryType", + "KekType", + "LogCollectionLevel", + "NotificationStageName", + "OverallValidationStatus", + "PortalDelayErrorCode", + "ReverseShippingDetailsEditStatus", + "ReverseTransportPreferenceEditStatus", + "ShareDestinationFormatType", + "SkuDisabledReason", + "SkuName", + "StageName", + "StageStatus", + "TransferConfigurationType", + "TransferType", + "TransportShipmentTypes", + "ValidationInputDiscriminator", + "ValidationStatus", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py new file mode 100644 index 000000000000..20d8d293952b --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_data_box_management_client_enums.py @@ -0,0 +1,505 @@ +# 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 +from azure.core import CaseInsensitiveEnumMeta + + +class AccessProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AccessProtocol.""" + + SMB = "SMB" + """Server Message Block protocol(SMB).""" + NFS = "NFS" + """Network File System protocol(NFS).""" + + +class AddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of address.""" + + NONE = "None" + """Address type not known.""" + RESIDENTIAL = "Residential" + """Residential Address.""" + COMMERCIAL = "Commercial" + """Commercial Address.""" + + +class AddressValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The address validation status.""" + + VALID = "Valid" + """Address provided is valid.""" + INVALID = "Invalid" + """Address provided is invalid or not supported.""" + AMBIGUOUS = "Ambiguous" + """Address provided is ambiguous, please choose one of the alternate addresses returned.""" + + +class ClassDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the type of job details.""" + + DATA_BOX = "DataBox" + """Data Box orders.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk orders.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy orders.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk orders.""" + + +class CopyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Status of the copy.""" + + NOT_STARTED = "NotStarted" + """Data copy hasn't started yet.""" + IN_PROGRESS = "InProgress" + """Data copy is in progress.""" + COMPLETED = "Completed" + """Data copy completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Data copy completed with errors.""" + FAILED = "Failed" + """Data copy failed. No data was copied.""" + NOT_RETURNED = "NotReturned" + """No copy triggered as device was not returned.""" + HARDWARE_ERROR = "HardwareError" + """The Device has hit hardware issues.""" + DEVICE_FORMATTED = "DeviceFormatted" + """Data copy failed. The Device was formatted by user.""" + DEVICE_METADATA_MODIFIED = "DeviceMetadataModified" + """Data copy failed. Device metadata was modified by user.""" + STORAGE_ACCOUNT_NOT_ACCESSIBLE = "StorageAccountNotAccessible" + """Data copy failed. Storage Account was not accessible during copy.""" + UNSUPPORTED_DATA = "UnsupportedData" + """Data copy failed. The Device data content is not supported.""" + DRIVE_NOT_RECEIVED = "DriveNotReceived" + """No copy triggered as device was not received.""" + UNSUPPORTED_DRIVE = "UnsupportedDrive" + """No copy triggered as device type is not supported.""" + OTHER_SERVICE_ERROR = "OtherServiceError" + """Copy failed due to service error.""" + OTHER_USER_ERROR = "OtherUserError" + """Copy failed due to user error.""" + DRIVE_NOT_DETECTED = "DriveNotDetected" + """Copy failed due to disk detection error.""" + DRIVE_CORRUPTED = "DriveCorrupted" + """Copy failed due to corrupted drive.""" + METADATA_FILES_MODIFIED_OR_REMOVED = "MetadataFilesModifiedOrRemoved" + """Copy failed due to modified or removed metadata files.""" + + +class CustomerResolutionCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CustomerResolutionCode.""" + + NONE = "None" + """No Resolution Yet""" + MOVE_TO_CLEAN_UP_DEVICE = "MoveToCleanUpDevice" + """Clean the device""" + RESUME = "Resume" + """Resume the job to same stage""" + RESTART = "Restart" + """Restart whole action.""" + REACH_OUT_TO_OPERATION = "ReachOutToOperation" + """Reach out to operation for further action.""" + + +class DataAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the account.""" + + STORAGE_ACCOUNT = "StorageAccount" + """Storage Accounts .""" + MANAGED_DISK = "ManagedDisk" + """Azure Managed disk storage.""" + + +class DatacenterAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data center address type.""" + + DATACENTER_ADDRESS_LOCATION = "DatacenterAddressLocation" + """Data center address location.""" + DATACENTER_ADDRESS_INSTRUCTION = "DatacenterAddressInstruction" + """Data center address instruction.""" + + +class DataCenterCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataCenter code.""" + + INVALID = "Invalid" + BY2 = "BY2" + BY1 = "BY1" + ORK70 = "ORK70" + AM2 = "AM2" + AMS20 = "AMS20" + BY21 = "BY21" + BY24 = "BY24" + MWH01 = "MWH01" + AMS06 = "AMS06" + SSE90 = "SSE90" + SYD03 = "SYD03" + SYD23 = "SYD23" + CBR20 = "CBR20" + YTO20 = "YTO20" + CWL20 = "CWL20" + LON24 = "LON24" + BOM01 = "BOM01" + BL20 = "BL20" + BL7 = "BL7" + SEL20 = "SEL20" + TYO01 = "TYO01" + BN1 = "BN1" + SN5 = "SN5" + CYS04 = "CYS04" + TYO22 = "TYO22" + YTO21 = "YTO21" + YQB20 = "YQB20" + FRA22 = "FRA22" + MAA01 = "MAA01" + CPQ02 = "CPQ02" + CPQ20 = "CPQ20" + SIN20 = "SIN20" + HKG20 = "HKG20" + SG2 = "SG2" + MEL23 = "MEL23" + SEL21 = "SEL21" + OSA20 = "OSA20" + SHA03 = "SHA03" + BJB = "BJB" + JNB22 = "JNB22" + JNB21 = "JNB21" + MNZ21 = "MNZ21" + SN8 = "SN8" + AUH20 = "AUH20" + ZRH20 = "ZRH20" + PUS20 = "PUS20" + AD_HOC = "AdHoc" + CH1 = "CH1" + DSM05 = "DSM05" + DUB07 = "DUB07" + PNQ01 = "PNQ01" + SVG20 = "SVG20" + OSA02 = "OSA02" + OSA22 = "OSA22" + PAR22 = "PAR22" + BN7 = "BN7" + SN6 = "SN6" + BJS20 = "BJS20" + + +class DelayNotificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of notification.""" + + ACTIVE = "Active" + """Delay is still active""" + RESOLVED = "Resolved" + """Delay has been resolved""" + + +class DoubleEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines secondary layer of software-based encryption enablement.""" + + ENABLED = "Enabled" + """Software-based encryption is enabled.""" + DISABLED = "Disabled" + """Software-based encryption is disabled.""" + + +class FilterFileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the filter file.""" + + AZURE_BLOB = "AzureBlob" + """Filter file is of the type AzureBlob.""" + AZURE_FILE = "AzureFile" + """Filter file is of the type AzureFiles.""" + + +class HardwareEncryption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines Hardware level encryption (Only for disk).""" + + ENABLED = "Enabled" + """Hardware-based encryption is enabled.""" + DISABLED = "Disabled" + """Hardware-based encryption is enabled.""" + + +class JobDeliveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delivery type of Job.""" + + NON_SCHEDULED = "NonScheduled" + """Non Scheduled job.""" + SCHEDULED = "Scheduled" + """Scheduled job.""" + + +class KekType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of encryption key used for key encryption.""" + + MICROSOFT_MANAGED = "MicrosoftManaged" + """Key encryption key is managed by Microsoft.""" + CUSTOMER_MANAGED = "CustomerManaged" + """Key encryption key is managed by the Customer.""" + + +class LogCollectionLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the logs to be collected.""" + + ERROR = "Error" + """Only Errors will be collected in the logs.""" + VERBOSE = "Verbose" + """Verbose logging (includes Errors, CRC, size information and others).""" + + +class NotificationStageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage.""" + + DEVICE_PREPARED = "DevicePrepared" + """Notification at device prepared stage.""" + DISPATCHED = "Dispatched" + """Notification at device dispatched stage.""" + DELIVERED = "Delivered" + """Notification at device delivered stage.""" + PICKED_UP = "PickedUp" + """Notification at device picked up from user stage.""" + AT_AZURE_DC = "AtAzureDC" + """Notification at device received at Azure datacenter stage.""" + DATA_COPY = "DataCopy" + """Notification at data copy started stage.""" + CREATED = "Created" + """Notification at job created stage.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Notification at shipped devices to customer stage.""" + + +class OverallValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Overall validation status.""" + + ALL_VALID_TO_PROCEED = "AllValidToProceed" + """Every input request is valid.""" + INPUTS_REVISIT_REQUIRED = "InputsRevisitRequired" + """Some input requests are not valid.""" + CERTAIN_INPUT_VALIDATIONS_SKIPPED = "CertainInputValidationsSkipped" + """Certain input validations skipped.""" + + +class PortalDelayErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Delay Error code.""" + + INTERNAL_ISSUE_DELAY = "InternalIssueDelay" + """Delay due to any internal reasons""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Active Order limit breached.""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """High demand""" + ACTIVE_ORDER_LIMIT_BREACHED_DELAY = "ActiveOrderLimitBreachedDelay" + """Slow copy due to large number of files""" + + +class ReverseShippingDetailsEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Shipping Address and Contact Info.""" + + ENABLED = "Enabled" + """Reverse shipping details can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse shipping details.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse shipping details. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ReverseTransportPreferenceEditStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Editable status for Reverse Transport preferences.""" + + ENABLED = "Enabled" + """Reverse Transport Preferences can be edited.""" + DISABLED = "Disabled" + """Edit is disabled for Reverse Transport Preferences.""" + NOT_SUPPORTED = "NotSupported" + """Edit is not supported for Reverse Transport Preferences. Either subscription feature is not + #: available or SKU doesn't support this feature.""" + + +class ShareDestinationFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the share.""" + + UNKNOWN_TYPE = "UnknownType" + """Unknown format.""" + HCS = "HCS" + """Storsimple data format.""" + BLOCK_BLOB = "BlockBlob" + """Azure storage block blob format.""" + PAGE_BLOB = "PageBlob" + """Azure storage page blob format.""" + AZURE_FILE = "AzureFile" + """Azure storage file format.""" + MANAGED_DISK = "ManagedDisk" + """Azure Compute Disk.""" + + +class SkuDisabledReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Reason why the Sku is disabled.""" + + NONE = "None" + """SKU is not disabled.""" + COUNTRY = "Country" + """SKU is not available in the requested country.""" + REGION = "Region" + """SKU is not available to push data to the requested Azure region.""" + FEATURE = "Feature" + """Required features are not enabled for the SKU.""" + OFFER_TYPE = "OfferType" + """Subscription does not have required offer types for the SKU.""" + NO_SUBSCRIPTION_INFO = "NoSubscriptionInfo" + """Subscription has not registered to Microsoft.DataBox and Service does not have the subscription + #: notification.""" + + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SkuName.""" + + DATA_BOX = "DataBox" + """Data Box.""" + DATA_BOX_DISK = "DataBoxDisk" + """Data Box Disk.""" + DATA_BOX_HEAVY = "DataBoxHeavy" + """Data Box Heavy.""" + DATA_BOX_CUSTOMER_DISK = "DataBoxCustomerDisk" + """Data Box Customer Disk""" + + +class StageName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the stage which is in progress.""" + + DEVICE_ORDERED = "DeviceOrdered" + """An order has been created.""" + DEVICE_PREPARED = "DevicePrepared" + """A device has been prepared for the order.""" + DISPATCHED = "Dispatched" + """Device has been dispatched to the user of the order.""" + DELIVERED = "Delivered" + """Device has been delivered to the user of the order.""" + PICKED_UP = "PickedUp" + """Device has been picked up from user and in transit to Azure datacenter.""" + AT_AZURE_DC = "AtAzureDC" + """Device has been received at Azure datacenter from the user.""" + DATA_COPY = "DataCopy" + """Data copy from the device at Azure datacenter.""" + COMPLETED = "Completed" + """Order has completed.""" + COMPLETED_WITH_ERRORS = "CompletedWithErrors" + """Order has completed with errors.""" + CANCELLED = "Cancelled" + """Order has been cancelled.""" + FAILED_ISSUE_REPORTED_AT_CUSTOMER = "Failed_IssueReportedAtCustomer" + """Order has failed due to issue reported by user.""" + FAILED_ISSUE_DETECTED_AT_AZURE_DC = "Failed_IssueDetectedAtAzureDC" + """Order has failed due to issue detected at Azure datacenter.""" + ABORTED = "Aborted" + """Order has been aborted.""" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """Order has completed with warnings.""" + READY_TO_DISPATCH_FROM_AZURE_DC = "ReadyToDispatchFromAzureDC" + """Device is ready to be handed to customer from Azure DC.""" + READY_TO_RECEIVE_AT_AZURE_DC = "ReadyToReceiveAtAzureDC" + """Device can be dropped off at Azure DC.""" + CREATED = "Created" + """Job created by the customer.""" + SHIPPED_TO_AZURE_DC = "ShippedToAzureDC" + """User shipped the device to AzureDC.""" + AWAITING_SHIPMENT_DETAILS = "AwaitingShipmentDetails" + """Awaiting shipment details of device from customer.""" + PREPARING_TO_SHIP_FROM_AZURE_DC = "PreparingToShipFromAzureDC" + """Preparing the device to ship to customer.""" + SHIPPED_TO_CUSTOMER = "ShippedToCustomer" + """Shipped the device to customer.""" + + +class StageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Holds the device erasure completion status.""" + + NONE = "None" + """No status available yet.""" + IN_PROGRESS = "InProgress" + """Stage is in progress.""" + SUCCEEDED = "Succeeded" + """Stage has succeeded.""" + FAILED = "Failed" + """Stage has failed.""" + CANCELLED = "Cancelled" + """Stage has been cancelled.""" + CANCELLING = "Cancelling" + """Stage is cancelling.""" + SUCCEEDED_WITH_ERRORS = "SucceededWithErrors" + """Stage has succeeded with errors.""" + WAITING_FOR_CUSTOMER_ACTION = "WaitingForCustomerAction" + """Stage is stuck until customer takes some action.""" + SUCCEEDED_WITH_WARNINGS = "SucceededWithWarnings" + """Stage has succeeded with warnings.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_KEK = "WaitingForCustomerActionForKek" + """Stage is waiting for customer action for kek action items.""" + WAITING_FOR_CUSTOMER_ACTION_FOR_CLEAN_UP = "WaitingForCustomerActionForCleanUp" + """Stage is waiting for customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED_FOR_CLEAN_UP = "CustomerActionPerformedForCleanUp" + """Stage has performed customer action for clean up.""" + CUSTOMER_ACTION_PERFORMED = "CustomerActionPerformed" + """Stage has performed customer action for clean up.""" + + +class TransferConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the configuration for transfer.""" + + TRANSFER_ALL = "TransferAll" + """Transfer all the data.""" + TRANSFER_USING_FILTER = "TransferUsingFilter" + """Transfer using filter.""" + + +class TransferType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the transfer.""" + + IMPORT_TO_AZURE = "ImportToAzure" + """Import data to azure.""" + EXPORT_FROM_AZURE = "ExportFromAzure" + """Export data from azure.""" + + +class TransportShipmentTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Transport Shipment Type supported for given region.""" + + CUSTOMER_MANAGED = "CustomerManaged" + """Shipment Logistics is handled by the customer.""" + MICROSOFT_MANAGED = "MicrosoftManaged" + """Shipment Logistics is handled by Microsoft.""" + + +class ValidationInputDiscriminator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identifies the type of validation request.""" + + VALIDATE_ADDRESS = "ValidateAddress" + """Identify request and response of address validation.""" + VALIDATE_SUBSCRIPTION_IS_ALLOWED_TO_CREATE_JOB = "ValidateSubscriptionIsAllowedToCreateJob" + """Identify request and response for validation of subscription permission to create job.""" + VALIDATE_PREFERENCES = "ValidatePreferences" + """Identify request and response of preference validation.""" + VALIDATE_CREATE_ORDER_LIMIT = "ValidateCreateOrderLimit" + """Identify request and response of create order limit for subscription validation.""" + VALIDATE_SKU_AVAILABILITY = "ValidateSkuAvailability" + """Identify request and response of active job limit for sku availability.""" + VALIDATE_DATA_TRANSFER_DETAILS = "ValidateDataTransferDetails" + """Identify request and response of data transfer details validation.""" + + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Create order limit validation status.""" + + VALID = "Valid" + """Validation is successful""" + INVALID = "Invalid" + """Validation is not successful""" + SKIPPED = "Skipped" + """Validation is skipped""" diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py new file mode 100644 index 000000000000..0b46baa61bcb --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_models_py3.py @@ -0,0 +1,6457 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccountCredentialDetails(_serialization.Model): + """Credential details of the account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_name: Name of the account. + :vartype account_name: str + :ivar data_account_type: Type of the account. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_connection_string: Connection string of the account endpoint to use the account + as a storage endpoint on the device. + :vartype account_connection_string: str + :ivar share_credential_details: Per share level unencrypted access credentials. + :vartype share_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.ShareCredentialDetails] + """ + + _validation = { + "account_name": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_connection_string": {"readonly": True}, + "share_credential_details": {"readonly": True}, + } + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_connection_string": {"key": "accountConnectionString", "type": "str"}, + "share_credential_details": {"key": "shareCredentialDetails", "type": "[ShareCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.account_name = None + self.data_account_type = None + self.account_connection_string = None + self.share_credential_details = None + + +class AdditionalErrorInfo(_serialization.Model): + """This class represents additional info which Resource Providers pass when an error occurs. + + :ivar info: Additional information of the type of error. + :vartype info: JSON + :ivar type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :vartype type: str + """ + + _attribute_map = { + "info": {"key": "info", "type": "object"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, info: Optional[JSON] = None, type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword info: Additional information of the type of error. + :paramtype info: JSON + :keyword type: Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation). + :paramtype type: str + """ + super().__init__(**kwargs) + self.info = info + self.type = type + + +class AddressValidationOutput(_serialization.Model): + """Output of the address validation api. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar validation_type: Identifies the type of validation response. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_03_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_03_01.models.ShippingAddress] + """ + + _validation = { + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "properties.validationType", "type": "str"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "validation_status": {"key": "properties.validationStatus", "type": "str"}, + "alternate_addresses": {"key": "properties.alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + self.validation_status = None + self.alternate_addresses = None + + +class ValidationInputResponse(_serialization.Model): + """Minimum properties that should be present in each individual validation response. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AddressValidationProperties, CreateOrderLimitForSubscriptionValidationResponseProperties, + DataTransferDetailsValidationResponseProperties, PreferencesValidationResponseProperties, + SkuAvailabilityValidationResponseProperties, + SubscriptionIsAllowedToCreateJobValidationResponseProperties + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "AddressValidationProperties", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationResponseProperties", + "ValidateDataTransferDetails": "DataTransferDetailsValidationResponseProperties", + "ValidatePreferences": "PreferencesValidationResponseProperties", + "ValidateSkuAvailability": "SkuAvailabilityValidationResponseProperties", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationResponseProperties", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + self.error = None + + +class AddressValidationProperties(ValidationInputResponse): + """The address validation output. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar validation_status: The address validation status. Known values are: "Valid", "Invalid", + and "Ambiguous". + :vartype validation_status: str or + ~azure.mgmt.databox.v2023_03_01.models.AddressValidationStatus + :ivar alternate_addresses: List of alternate addresses. + :vartype alternate_addresses: list[~azure.mgmt.databox.v2023_03_01.models.ShippingAddress] + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "validation_status": {"readonly": True}, + "alternate_addresses": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "validation_status": {"key": "validationStatus", "type": "str"}, + "alternate_addresses": {"key": "alternateAddresses", "type": "[ShippingAddress]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.validation_status = None + self.alternate_addresses = None + + +class ApiError(_serialization.Model): + """ApiError. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.ErrorDetail + """ + + _validation = { + "error": {"required": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: "_models.ErrorDetail", **kwargs: Any) -> None: + """ + :keyword error: Required. + :paramtype error: ~azure.mgmt.databox.v2023_03_01.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ApplianceNetworkConfiguration(_serialization.Model): + """The Network Adapter configuration of a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the network. + :vartype name: str + :ivar mac_address: Mac Address. + :vartype mac_address: str + """ + + _validation = { + "name": {"readonly": True}, + "mac_address": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "mac_address": {"key": "macAddress", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.mac_address = None + + +class ArmBaseObject(_serialization.Model): + """Base class for all objects under resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + + +class AvailableSkuRequest(_serialization.Model): + """The filters for showing the available skus. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + :ivar sku_names: Sku Names to filter for available skus. + :vartype sku_names: list[str or ~azure.mgmt.databox.v2023_03_01.models.SkuName] + """ + + _validation = { + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "sku_names": {"key": "skuNames", "type": "[str]"}, + } + + def __init__( + self, + *, + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + sku_names: Optional[List[Union[str, "_models.SkuName"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + :keyword sku_names: Sku Names to filter for available skus. + :paramtype sku_names: list[str or ~azure.mgmt.databox.v2023_03_01.models.SkuName] + """ + super().__init__(**kwargs) + self.transfer_type = transfer_type + self.country = country + self.location = location + self.sku_names = sku_names + + +class AvailableSkusResult(_serialization.Model): + """The available skus operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of available skus. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :ivar next_link: Link for the next set of skus. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SkuInformation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of skus. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class AzureFileFilterDetails(_serialization.Model): + """Filter details to transfer Azure files. + + :ivar file_prefix_list: Prefix list of the Azure files to be transferred. + :vartype file_prefix_list: list[str] + :ivar file_path_list: List of full path of the files to be transferred. + :vartype file_path_list: list[str] + :ivar file_share_list: List of file shares to be transferred. + :vartype file_share_list: list[str] + """ + + _attribute_map = { + "file_prefix_list": {"key": "filePrefixList", "type": "[str]"}, + "file_path_list": {"key": "filePathList", "type": "[str]"}, + "file_share_list": {"key": "fileShareList", "type": "[str]"}, + } + + def __init__( + self, + *, + file_prefix_list: Optional[List[str]] = None, + file_path_list: Optional[List[str]] = None, + file_share_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword file_prefix_list: Prefix list of the Azure files to be transferred. + :paramtype file_prefix_list: list[str] + :keyword file_path_list: List of full path of the files to be transferred. + :paramtype file_path_list: list[str] + :keyword file_share_list: List of file shares to be transferred. + :paramtype file_share_list: list[str] + """ + super().__init__(**kwargs) + self.file_prefix_list = file_prefix_list + self.file_path_list = file_path_list + self.file_share_list = file_share_list + + +class BlobFilterDetails(_serialization.Model): + """Filter details to transfer Azure Blobs. + + :ivar blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :vartype blob_prefix_list: list[str] + :ivar blob_path_list: List of full path of the blobs to be transferred. + :vartype blob_path_list: list[str] + :ivar container_list: List of blob containers to be transferred. + :vartype container_list: list[str] + """ + + _attribute_map = { + "blob_prefix_list": {"key": "blobPrefixList", "type": "[str]"}, + "blob_path_list": {"key": "blobPathList", "type": "[str]"}, + "container_list": {"key": "containerList", "type": "[str]"}, + } + + def __init__( + self, + *, + blob_prefix_list: Optional[List[str]] = None, + blob_path_list: Optional[List[str]] = None, + container_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_prefix_list: Prefix list of the Azure blobs to be transferred. + :paramtype blob_prefix_list: list[str] + :keyword blob_path_list: List of full path of the blobs to be transferred. + :paramtype blob_path_list: list[str] + :keyword container_list: List of blob containers to be transferred. + :paramtype container_list: list[str] + """ + super().__init__(**kwargs) + self.blob_prefix_list = blob_prefix_list + self.blob_path_list = blob_path_list + self.container_list = container_list + + +class CancellationReason(_serialization.Model): + """Reason for cancellation. + + All required parameters must be populated in order to send to Azure. + + :ivar reason: Reason for cancellation. Required. + :vartype reason: str + """ + + _validation = { + "reason": {"required": True}, + } + + _attribute_map = { + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, *, reason: str, **kwargs: Any) -> None: + """ + :keyword reason: Reason for cancellation. Required. + :paramtype reason: str + """ + super().__init__(**kwargs) + self.reason = reason + + +class CloudError(_serialization.Model): + """Provides additional information about an http error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_info: Gets or sets additional error info. + :vartype additional_info: list[~azure.mgmt.databox.v2023_03_01.models.AdditionalErrorInfo] + :ivar code: Error code. + :vartype code: str + :ivar details: Gets or sets details for the error. + :vartype details: list[~azure.mgmt.databox.v2023_03_01.models.CloudError] + :ivar message: The error message parsed from the body of the http error response. + :vartype message: str + :ivar target: Gets or sets the target of the error. + :vartype target: str + """ + + _validation = { + "additional_info": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "additional_info": {"key": "additionalInfo", "type": "[AdditionalErrorInfo]"}, + "code": {"key": "code", "type": "str"}, + "details": {"key": "details", "type": "[CloudError]"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: The error message parsed from the body of the http error response. + :paramtype message: str + :keyword target: Gets or sets the target of the error. + :paramtype target: str + """ + super().__init__(**kwargs) + self.additional_info = None + self.code = code + self.details = None + self.message = message + self.target = target + + +class ContactDetails(_serialization.Model): + """Contact Details. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + :ivar email_list: List of Email-ids to be notified about job progress. Required. + :vartype email_list: list[str] + :ivar notification_preference: Notification preference for a job stage. + :vartype notification_preference: + list[~azure.mgmt.databox.v2023_03_01.models.NotificationPreference] + """ + + _validation = { + "contact_name": {"required": True}, + "phone": {"required": True}, + "email_list": {"required": True}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + "email_list": {"key": "emailList", "type": "[str]"}, + "notification_preference": {"key": "notificationPreference", "type": "[NotificationPreference]"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + email_list: List[str], + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + notification_preference: Optional[List["_models.NotificationPreference"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + :keyword email_list: List of Email-ids to be notified about job progress. Required. + :paramtype email_list: list[str] + :keyword notification_preference: Notification preference for a job stage. + :paramtype notification_preference: + list[~azure.mgmt.databox.v2023_03_01.models.NotificationPreference] + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + self.email_list = email_list + self.notification_preference = notification_preference + + +class ContactInfo(_serialization.Model): + """Contact Info. + + All required parameters must be populated in order to send to Azure. + + :ivar contact_name: Contact name of the person. Required. + :vartype contact_name: str + :ivar phone: Phone number of the contact person. Required. + :vartype phone: str + :ivar phone_extension: Phone extension number of the contact person. + :vartype phone_extension: str + :ivar mobile: Mobile number of the contact person. + :vartype mobile: str + """ + + _validation = { + "contact_name": {"required": True, "min_length": 1}, + "phone": {"required": True, "min_length": 1}, + } + + _attribute_map = { + "contact_name": {"key": "contactName", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "mobile": {"key": "mobile", "type": "str"}, + } + + def __init__( + self, + *, + contact_name: str, + phone: str, + phone_extension: Optional[str] = None, + mobile: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_name: Contact name of the person. Required. + :paramtype contact_name: str + :keyword phone: Phone number of the contact person. Required. + :paramtype phone: str + :keyword phone_extension: Phone extension number of the contact person. + :paramtype phone_extension: str + :keyword mobile: Mobile number of the contact person. + :paramtype mobile: str + """ + super().__init__(**kwargs) + self.contact_name = contact_name + self.phone = phone + self.phone_extension = phone_extension + self.mobile = mobile + + +class CopyLogDetails(_serialization.Model): + """Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxAccountCopyLogDetails, DataBoxCustomerDiskCopyLogDetails, DataBoxDiskCopyLogDetails, + DataBoxHeavyAccountCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = { + "copy_log_details_type": { + "DataBox": "DataBoxAccountCopyLogDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskCopyLogDetails", + "DataBoxDisk": "DataBoxDiskCopyLogDetails", + "DataBoxHeavy": "DataBoxHeavyAccountCopyLogDetails", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class CopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class ValidationRequest(_serialization.Model): + """Minimum request requirement of any validation category. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateJobValidations + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + _subtype_map = {"validation_category": {"JobCreationValidation": "CreateJobValidations"}} + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + super().__init__(**kwargs) + self.validation_category: Optional[str] = None + self.individual_request_details = individual_request_details + + +class CreateJobValidations(ValidationRequest): + """It does all pre-job creation validations. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_category: Identify the nature of validation. Required. Default value is + "JobCreationValidation". + :vartype validation_category: str + :ivar individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :vartype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + + _validation = { + "validation_category": {"required": True}, + "individual_request_details": {"required": True}, + } + + _attribute_map = { + "validation_category": {"key": "validationCategory", "type": "str"}, + "individual_request_details": {"key": "individualRequestDetails", "type": "[ValidationInputRequest]"}, + } + + def __init__(self, *, individual_request_details: List["_models.ValidationInputRequest"], **kwargs: Any) -> None: + """ + :keyword individual_request_details: List of request details contain validationType and its + request as key and value respectively. Required. + :paramtype individual_request_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputRequest] + """ + super().__init__(individual_request_details=individual_request_details, **kwargs) + self.validation_category: str = "JobCreationValidation" + + +class ValidationInputRequest(_serialization.Model): + """Minimum fields that must be present in any type of validation request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateAddress, CreateOrderLimitForSubscriptionValidationRequest, + DataTransferDetailsValidationRequest, PreferencesValidationRequest, + SkuAvailabilityValidationRequest, SubscriptionIsAllowedToCreateJobValidationRequest + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + _subtype_map = { + "validation_type": { + "ValidateAddress": "ValidateAddress", + "ValidateCreateOrderLimit": "CreateOrderLimitForSubscriptionValidationRequest", + "ValidateDataTransferDetails": "DataTransferDetailsValidationRequest", + "ValidatePreferences": "PreferencesValidationRequest", + "ValidateSkuAvailability": "SkuAvailabilityValidationRequest", + "ValidateSubscriptionIsAllowedToCreateJob": "SubscriptionIsAllowedToCreateJobValidationRequest", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: Optional[str] = None + + +class CreateOrderLimitForSubscriptionValidationRequest(ValidationInputRequest): + """Request to validate create order limit for current subscription. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__(self, *, device_type: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.device_type = device_type + + +class CreateOrderLimitForSubscriptionValidationResponseProperties(ValidationInputResponse): + """Properties of create order limit for subscription validation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Create order limit validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateCreateOrderLimit" + self.status = None + + +class JobSecrets(_serialization.Model): + """The base class for the secrets. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataboxJobSecrets, CustomerDiskJobSecrets, DataBoxDiskJobSecrets, DataBoxHeavyJobSecrets + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + } + + _subtype_map = { + "job_secrets_type": { + "DataBox": "DataboxJobSecrets", + "DataBoxCustomerDisk": "CustomerDiskJobSecrets", + "DataBoxDisk": "DataBoxDiskJobSecrets", + "DataBoxHeavy": "DataBoxHeavyJobSecrets", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: Optional[str] = None + self.dc_access_security_code = None + self.error = None + + +class CustomerDiskJobSecrets(JobSecrets): + """The secrets related to customer disk job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DiskSecret] + :ivar carrier_account_number: Carrier Account Number of the customer. + :vartype carrier_account_number: str + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "carrier_account_number": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxCustomerDisk" + self.disk_secrets = None + self.carrier_account_number = None + + +class DataAccountDetails(_serialization.Model): + """Account details of the data to be transferred. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ManagedDiskDetails, StorageAccountDetails + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + } + + _subtype_map = { + "data_account_type": {"ManagedDisk": "ManagedDiskDetails", "StorageAccount": "StorageAccountDetails"} + } + + def __init__(self, *, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + """ + super().__init__(**kwargs) + self.data_account_type: Optional[str] = None + self.share_password = share_password + + +class DataBoxAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account of a DataBox job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: str + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when + LogCollectionLevel is set to Verbose. + :vartype copy_verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "str"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBox" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxCustomerDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for customer disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxCustomerDiskCopyProgress(CopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox CustomerDisk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class JobDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Job details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxJobDetails, DataBoxCustomerDiskJobDetails, DataBoxDiskJobDetails, DataBoxHeavyJobDetails + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + } + + _subtype_map = { + "job_details_type": { + "DataBox": "DataBoxJobDetails", + "DataBoxCustomerDisk": "DataBoxCustomerDiskJobDetails", + "DataBoxDisk": "DataBoxDiskJobDetails", + "DataBoxHeavy": "DataBoxHeavyJobDetails", + } + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(**kwargs) + self.job_stages = None + self.contact_details = contact_details + self.shipping_address = shipping_address + self.delivery_package = None + self.return_package = None + self.data_import_details = data_import_details + self.data_export_details = data_export_details + self.job_details_type: Optional[str] = None + self.preferences = preferences + self.reverse_shipping_details = reverse_shipping_details + self.copy_log_details = None + self.reverse_shipment_label_sas_key = None + self.chain_of_custody_sas_key = None + self.device_erasure_details = None + self.key_encryption_key = key_encryption_key + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + self.actions = None + self.last_mitigation_action_on_job = None + self.datacenter_address = None + self.data_center_code = None + + +class DataBoxCustomerDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Customer disk job details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :vartype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ImportDiskDetails] + :ivar export_disk_details_collection: Contains the map of disk serial number to the disk + details for export jobs. + :vartype export_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ExportDiskDetails] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxCustomerDiskCopyProgress] + :ivar deliver_to_dc_package_details: Delivery package shipping details. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + :ivar return_to_customer_package_details: Return package shipping details. Required. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + :ivar enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :vartype enable_manifest_backup: bool + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "export_disk_details_collection": {"readonly": True}, + "copy_progress": {"readonly": True}, + "deliver_to_dc_package_details": {"readonly": True}, + "return_to_customer_package_details": {"required": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "import_disk_details_collection": {"key": "importDiskDetailsCollection", "type": "{ImportDiskDetails}"}, + "export_disk_details_collection": {"key": "exportDiskDetailsCollection", "type": "{ExportDiskDetails}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxCustomerDiskCopyProgress]"}, + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + "enable_manifest_backup": {"key": "enableManifestBackup", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + return_to_customer_package_details: "_models.PackageCarrierDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + import_disk_details_collection: Optional[Dict[str, "_models.ImportDiskDetails"]] = None, + enable_manifest_backup: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword import_disk_details_collection: Contains the map of disk serial number to the disk + details for import jobs. + :paramtype import_disk_details_collection: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.ImportDiskDetails] + :keyword return_to_customer_package_details: Return package shipping details. Required. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + :keyword enable_manifest_backup: Flag to indicate if disk manifest should be backed-up in the + Storage Account. + :paramtype enable_manifest_backup: bool + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxCustomerDisk" + self.import_disk_details_collection = import_disk_details_collection + self.export_disk_details_collection = None + self.copy_progress = None + self.deliver_to_dc_package_details = None + self.return_to_customer_package_details = return_to_customer_package_details + self.enable_manifest_backup = enable_manifest_backup + + +class DataBoxDiskCopyLogDetails(CopyLogDetails): + """Copy Log Details for a disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar disk_serial_number: Disk Serial Number. + :vartype disk_serial_number: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "disk_serial_number": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxDisk" + self.disk_serial_number = None + self.error_log_link = None + self.verbose_log_link = None + + +class DataBoxDiskCopyProgress(_serialization.Model): + """DataBox Disk Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar serial_number: The serial number of the disk. + :vartype serial_number: str + :ivar bytes_copied: Bytes copied during the copy of disk. + :vartype bytes_copied: int + :ivar percent_complete: Indicates the percentage completed for the copy of the disk. + :vartype percent_complete: int + :ivar status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "serial_number": {"readonly": True}, + "bytes_copied": {"readonly": True}, + "percent_complete": {"readonly": True}, + "status": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "bytes_copied": {"key": "bytesCopied", "type": "int"}, + "percent_complete": {"key": "percentComplete", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.bytes_copied = None + self.percent_complete = None + self.status = None + self.error = None + self.actions = None + + +class GranularCopyLogDetails(_serialization.Model): + """Granular Details for log generated during copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxDiskGranularCopyLogDetails + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + """ + + _validation = { + "copy_log_details_type": {"required": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + } + + _subtype_map = {"copy_log_details_type": {"DataBoxCustomerDisk": "DataBoxDiskGranularCopyLogDetails"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: Optional[str] = None + + +class DataBoxDiskGranularCopyLogDetails(GranularCopyLogDetails): + """Granular Copy Log Details for customer disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar account_id: Account id. + :vartype account_id: str + :ivar error_log_link: Link for copy error logs. + :vartype error_log_link: str + :ivar verbose_log_link: Link for copy verbose logs. + :vartype verbose_log_link: str + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "serial_number": {"readonly": True}, + "account_id": {"readonly": True}, + "error_log_link": {"readonly": True}, + "verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "error_log_link": {"key": "errorLogLink", "type": "str"}, + "verbose_log_link": {"key": "verboseLogLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxCustomerDisk" + self.serial_number = None + self.account_id = None + self.error_log_link = None + self.verbose_log_link = None + + +class GranularCopyProgress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Granular Copy progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.storage_account_name = None + self.transfer_type = None + self.data_account_type = None + self.account_id = None + self.bytes_processed = None + self.total_bytes_to_process = None + self.files_processed = None + self.total_files_to_process = None + self.invalid_files_processed = None + self.invalid_file_bytes_uploaded = None + self.renamed_container_count = None + self.files_errored_out = None + self.directories_errored_out = None + self.invalid_directories_processed = None + self.is_enumeration_in_progress = None + self.error = None + self.actions = None + + +class DataBoxDiskGranularCopyProgress(GranularCopyProgress): # pylint: disable=too-many-instance-attributes + """DataBox Disk Granular Copy Progress. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar storage_account_name: Name of the storage account. This will be empty for data account + types other than storage account. + :vartype storage_account_name: str + :ivar transfer_type: Transfer type of data. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar data_account_type: Data Account Type. Known values are: "StorageAccount" and + "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar account_id: Id of the account where the data needs to be uploaded. + :vartype account_id: str + :ivar bytes_processed: To indicate bytes transferred. + :vartype bytes_processed: int + :ivar total_bytes_to_process: Total amount of data to be processed by the job. + :vartype total_bytes_to_process: int + :ivar files_processed: Number of files processed. + :vartype files_processed: int + :ivar total_files_to_process: Total files to process. + :vartype total_files_to_process: int + :ivar invalid_files_processed: Number of files not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype invalid_files_processed: int + :ivar invalid_file_bytes_uploaded: Total amount of data not adhering to azure naming + conventions which were processed by automatic renaming. + :vartype invalid_file_bytes_uploaded: int + :ivar renamed_container_count: Number of folders not adhering to azure naming conventions which + were processed by automatic renaming. + :vartype renamed_container_count: int + :ivar files_errored_out: Number of files which could not be copied. + :vartype files_errored_out: int + :ivar directories_errored_out: To indicate directories errored out in the job. + :vartype directories_errored_out: int + :ivar invalid_directories_processed: To indicate directories renamed. + :vartype invalid_directories_processed: int + :ivar is_enumeration_in_progress: To indicate if enumeration of data is in progress. + Until this is true, the TotalBytesToProcess may not be valid. + :vartype is_enumeration_in_progress: bool + :ivar error: Error, if any, in the stage. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar serial_number: Disk Serial Number. + :vartype serial_number: str + :ivar copy_status: The Status of the copy. Known values are: "NotStarted", "InProgress", + "Completed", "CompletedWithErrors", "Failed", "NotReturned", "HardwareError", + "DeviceFormatted", "DeviceMetadataModified", "StorageAccountNotAccessible", "UnsupportedData", + "DriveNotReceived", "UnsupportedDrive", "OtherServiceError", "OtherUserError", + "DriveNotDetected", "DriveCorrupted", and "MetadataFilesModifiedOrRemoved". + :vartype copy_status: str or ~azure.mgmt.databox.v2023_03_01.models.CopyStatus + """ + + _validation = { + "storage_account_name": {"readonly": True}, + "transfer_type": {"readonly": True}, + "data_account_type": {"readonly": True}, + "account_id": {"readonly": True}, + "bytes_processed": {"readonly": True}, + "total_bytes_to_process": {"readonly": True}, + "files_processed": {"readonly": True}, + "total_files_to_process": {"readonly": True}, + "invalid_files_processed": {"readonly": True}, + "invalid_file_bytes_uploaded": {"readonly": True}, + "renamed_container_count": {"readonly": True}, + "files_errored_out": {"readonly": True}, + "directories_errored_out": {"readonly": True}, + "invalid_directories_processed": {"readonly": True}, + "is_enumeration_in_progress": {"readonly": True}, + "error": {"readonly": True}, + "actions": {"readonly": True}, + "serial_number": {"readonly": True}, + "copy_status": {"readonly": True}, + } + + _attribute_map = { + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "bytes_processed": {"key": "bytesProcessed", "type": "int"}, + "total_bytes_to_process": {"key": "totalBytesToProcess", "type": "int"}, + "files_processed": {"key": "filesProcessed", "type": "int"}, + "total_files_to_process": {"key": "totalFilesToProcess", "type": "int"}, + "invalid_files_processed": {"key": "invalidFilesProcessed", "type": "int"}, + "invalid_file_bytes_uploaded": {"key": "invalidFileBytesUploaded", "type": "int"}, + "renamed_container_count": {"key": "renamedContainerCount", "type": "int"}, + "files_errored_out": {"key": "filesErroredOut", "type": "int"}, + "directories_errored_out": {"key": "directoriesErroredOut", "type": "int"}, + "invalid_directories_processed": {"key": "invalidDirectoriesProcessed", "type": "int"}, + "is_enumeration_in_progress": {"key": "isEnumerationInProgress", "type": "bool"}, + "error": {"key": "error", "type": "CloudError"}, + "actions": {"key": "actions", "type": "[str]"}, + "serial_number": {"key": "serialNumber", "type": "str"}, + "copy_status": {"key": "copyStatus", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.serial_number = None + self.copy_status = None + + +class DataBoxDiskJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """DataBox Disk Job Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :vartype preferred_disks: dict[str, int] + :ivar copy_progress: Copy progress per disk. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskCopyProgress] + :ivar granular_copy_progress: Copy progress per disk. + :vartype granular_copy_progress: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskGranularCopyProgress] + :ivar granular_copy_log_details: Copy progress per disk. + :vartype granular_copy_log_details: + list[~azure.mgmt.databox.v2023_03_01.models.DataBoxDiskGranularCopyLogDetails] + :ivar disks_and_size_details: Contains the map of disk serial number to the disk size being + used for the job. Is returned only after the disks are shipped to the customer. + :vartype disks_and_size_details: dict[str, int] + :ivar passkey: User entered passkey for DataBox Disk job. + :vartype passkey: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + "granular_copy_progress": {"readonly": True}, + "granular_copy_log_details": {"readonly": True}, + "disks_and_size_details": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "preferred_disks": {"key": "preferredDisks", "type": "{int}"}, + "copy_progress": {"key": "copyProgress", "type": "[DataBoxDiskCopyProgress]"}, + "granular_copy_progress": {"key": "granularCopyProgress", "type": "[DataBoxDiskGranularCopyProgress]"}, + "granular_copy_log_details": {"key": "granularCopyLogDetails", "type": "[DataBoxDiskGranularCopyLogDetails]"}, + "disks_and_size_details": {"key": "disksAndSizeDetails", "type": "{int}"}, + "passkey": {"key": "passkey", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + preferred_disks: Optional[Dict[str, int]] = None, + passkey: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword preferred_disks: User preference on what size disks are needed for the job. The map is + from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but + will be checked against an int. + :paramtype preferred_disks: dict[str, int] + :keyword passkey: User entered passkey for DataBox Disk job. + :paramtype passkey: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxDisk" + self.preferred_disks = preferred_disks + self.copy_progress = None + self.granular_copy_progress = None + self.granular_copy_log_details = None + self.disks_and_size_details = None + self.passkey = passkey + + +class DataBoxDiskJobSecrets(JobSecrets): + """The secrets related to disk job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar disk_secrets: Contains the list of secrets object for that device. + :vartype disk_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DiskSecret] + :ivar pass_key: PassKey for the disk Job. + :vartype pass_key: str + :ivar is_passkey_user_defined: Whether passkey was provided by user. + :vartype is_passkey_user_defined: bool + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "disk_secrets": {"readonly": True}, + "pass_key": {"readonly": True}, + "is_passkey_user_defined": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "disk_secrets": {"key": "diskSecrets", "type": "[DiskSecret]"}, + "pass_key": {"key": "passKey", "type": "str"}, + "is_passkey_user_defined": {"key": "isPasskeyUserDefined", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxDisk" + self.disk_secrets = None + self.pass_key = None + self.is_passkey_user_defined = None + + +class DataBoxHeavyAccountCopyLogDetails(CopyLogDetails): + """Copy log details for a storage account for Databox heavy. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar copy_log_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype copy_log_details_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar account_name: Account name. + :vartype account_name: str + :ivar copy_log_link: Link for copy logs. + :vartype copy_log_link: list[str] + :ivar copy_verbose_log_link: Link for copy verbose logs. This will be set only when the + LogCollectionLevel is set to verbose. + :vartype copy_verbose_log_link: list[str] + """ + + _validation = { + "copy_log_details_type": {"required": True}, + "account_name": {"readonly": True}, + "copy_log_link": {"readonly": True}, + "copy_verbose_log_link": {"readonly": True}, + } + + _attribute_map = { + "copy_log_details_type": {"key": "copyLogDetailsType", "type": "str"}, + "account_name": {"key": "accountName", "type": "str"}, + "copy_log_link": {"key": "copyLogLink", "type": "[str]"}, + "copy_verbose_log_link": {"key": "copyVerboseLogLink", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.copy_log_details_type: str = "DataBoxHeavy" + self.account_name = None + self.copy_log_link = None + self.copy_verbose_log_link = None + + +class DataBoxHeavyJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Heavy Device Job Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar copy_progress: Copy progress per account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox Heavy. Should not be passed + for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBoxHeavy" + self.copy_progress = None + self.device_password = device_password + + +class DataBoxHeavyJobSecrets(JobSecrets): + """The secrets related to a databox heavy job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar cabinet_pod_secrets: Contains the list of secret objects for a databox heavy job. + :vartype cabinet_pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxHeavySecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + "cabinet_pod_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "cabinet_pod_secrets": {"key": "cabinetPodSecrets", "type": "[DataBoxHeavySecret]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBoxHeavy" + self.cabinet_pod_secrets = None + + +class DataBoxHeavySecret(_serialization.Model): + """The secrets related to a databox heavy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_03_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DataBoxJobDetails(JobDetails): # pylint: disable=too-many-instance-attributes + """Databox Job Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_stages: List of stages that run in the job. + :vartype job_stages: list[~azure.mgmt.databox.v2023_03_01.models.JobStages] + :ivar contact_details: Contact details for notification and shipping. Required. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar delivery_package: Delivery package shipping details. + :vartype delivery_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar return_package: Return package shipping details. + :vartype return_package: ~azure.mgmt.databox.v2023_03_01.models.PackageShippingDetails + :ivar data_import_details: Details of the data to be imported into azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar data_export_details: Details of the data to be exported from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar job_details_type: Indicates the type of job details. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_details_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar preferences: Preferences for the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar reverse_shipping_details: Optional Reverse Shipping details for order. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar copy_log_details: List of copy log details. + :vartype copy_log_details: list[~azure.mgmt.databox.v2023_03_01.models.CopyLogDetails] + :ivar reverse_shipment_label_sas_key: Shared access key to download the return shipment label. + :vartype reverse_shipment_label_sas_key: str + :ivar chain_of_custody_sas_key: Shared access key to download the chain of custody logs. + :vartype chain_of_custody_sas_key: str + :ivar device_erasure_details: Holds device data erasure details. + :vartype device_erasure_details: ~azure.mgmt.databox.v2023_03_01.models.DeviceErasureDetails + :ivar key_encryption_key: Details about which key encryption type is being used. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :vartype expected_data_size_in_tera_bytes: int + :ivar actions: Available actions on the job. + :vartype actions: list[str or ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + :ivar last_mitigation_action_on_job: Last mitigation action performed on the job. + :vartype last_mitigation_action_on_job: + ~azure.mgmt.databox.v2023_03_01.models.LastMitigationActionOnJob + :ivar datacenter_address: Datacenter address to ship to, for the given sku and storage + location. + :vartype datacenter_address: ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + :ivar data_center_code: DataCenter code. Known values are: "Invalid", "BY2", "BY1", "ORK70", + "AM2", "AMS20", "BY21", "BY24", "MWH01", "AMS06", "SSE90", "SYD03", "SYD23", "CBR20", "YTO20", + "CWL20", "LON24", "BOM01", "BL20", "BL7", "SEL20", "TYO01", "BN1", "SN5", "CYS04", "TYO22", + "YTO21", "YQB20", "FRA22", "MAA01", "CPQ02", "CPQ20", "SIN20", "HKG20", "SG2", "MEL23", + "SEL21", "OSA20", "SHA03", "BJB", "JNB22", "JNB21", "MNZ21", "SN8", "AUH20", "ZRH20", "PUS20", + "AdHoc", "CH1", "DSM05", "DUB07", "PNQ01", "SVG20", "OSA02", "OSA22", "PAR22", "BN7", "SN6", + and "BJS20". + :vartype data_center_code: str or ~azure.mgmt.databox.v2023_03_01.models.DataCenterCode + :ivar copy_progress: Copy progress per storage account. + :vartype copy_progress: list[~azure.mgmt.databox.v2023_03_01.models.CopyProgress] + :ivar device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype device_password: str + """ + + _validation = { + "job_stages": {"readonly": True}, + "contact_details": {"required": True}, + "delivery_package": {"readonly": True}, + "return_package": {"readonly": True}, + "job_details_type": {"required": True}, + "copy_log_details": {"readonly": True}, + "reverse_shipment_label_sas_key": {"readonly": True}, + "chain_of_custody_sas_key": {"readonly": True}, + "device_erasure_details": {"readonly": True}, + "actions": {"readonly": True}, + "last_mitigation_action_on_job": {"readonly": True}, + "datacenter_address": {"readonly": True}, + "data_center_code": {"readonly": True}, + "copy_progress": {"readonly": True}, + } + + _attribute_map = { + "job_stages": {"key": "jobStages", "type": "[JobStages]"}, + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "delivery_package": {"key": "deliveryPackage", "type": "PackageShippingDetails"}, + "return_package": {"key": "returnPackage", "type": "PackageShippingDetails"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "job_details_type": {"key": "jobDetailsType", "type": "str"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "copy_log_details": {"key": "copyLogDetails", "type": "[CopyLogDetails]"}, + "reverse_shipment_label_sas_key": {"key": "reverseShipmentLabelSasKey", "type": "str"}, + "chain_of_custody_sas_key": {"key": "chainOfCustodySasKey", "type": "str"}, + "device_erasure_details": {"key": "deviceErasureDetails", "type": "DeviceErasureDetails"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + "actions": {"key": "actions", "type": "[str]"}, + "last_mitigation_action_on_job": {"key": "lastMitigationActionOnJob", "type": "LastMitigationActionOnJob"}, + "datacenter_address": {"key": "datacenterAddress", "type": "DatacenterAddressResponse"}, + "data_center_code": {"key": "dataCenterCode", "type": "str"}, + "copy_progress": {"key": "copyProgress", "type": "[CopyProgress]"}, + "device_password": {"key": "devicePassword", "type": "str"}, + } + + def __init__( + self, + *, + contact_details: "_models.ContactDetails", + shipping_address: Optional["_models.ShippingAddress"] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + preferences: Optional["_models.Preferences"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + expected_data_size_in_tera_bytes: Optional[int] = None, + device_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. Required. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword data_import_details: Details of the data to be imported into azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword data_export_details: Details of the data to be exported from azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword preferences: Preferences for the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword reverse_shipping_details: Optional Reverse Shipping details for order. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword key_encryption_key: Details about which key encryption type is being used. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. + :paramtype expected_data_size_in_tera_bytes: int + :keyword device_password: Set Device password for unlocking Databox. Should not be passed for + TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password + itself. This will not be returned in Get Call. Password Requirements : Password must be + minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, + one number and one special character. Password cannot have the following characters : IilLoO0 + Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype device_password: str + """ + super().__init__( + contact_details=contact_details, + shipping_address=shipping_address, + data_import_details=data_import_details, + data_export_details=data_export_details, + preferences=preferences, + reverse_shipping_details=reverse_shipping_details, + key_encryption_key=key_encryption_key, + expected_data_size_in_tera_bytes=expected_data_size_in_tera_bytes, + **kwargs + ) + self.job_details_type: str = "DataBox" + self.copy_progress = None + self.device_password = device_password + + +class DataboxJobSecrets(JobSecrets): + """The secrets related to a databox job. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar job_secrets_type: Used to indicate what type of job secrets object. Required. Known + values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype job_secrets_type: str or ~azure.mgmt.databox.v2023_03_01.models.ClassDiscriminator + :ivar dc_access_security_code: Dc Access Security Code for Customer Managed Shipping. + :vartype dc_access_security_code: ~azure.mgmt.databox.v2023_03_01.models.DcAccessSecurityCode + :ivar error: Error while fetching the secrets. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar pod_secrets: Contains the list of secret objects for a job. + :vartype pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxSecret] + """ + + _validation = { + "job_secrets_type": {"required": True}, + "dc_access_security_code": {"readonly": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "job_secrets_type": {"key": "jobSecretsType", "type": "str"}, + "dc_access_security_code": {"key": "dcAccessSecurityCode", "type": "DcAccessSecurityCode"}, + "error": {"key": "error", "type": "CloudError"}, + "pod_secrets": {"key": "podSecrets", "type": "[DataBoxSecret]"}, + } + + def __init__(self, *, pod_secrets: Optional[List["_models.DataBoxSecret"]] = None, **kwargs: Any) -> None: + """ + :keyword pod_secrets: Contains the list of secret objects for a job. + :paramtype pod_secrets: list[~azure.mgmt.databox.v2023_03_01.models.DataBoxSecret] + """ + super().__init__(**kwargs) + self.job_secrets_type: str = "DataBox" + self.pod_secrets = pod_secrets + + +class ScheduleAvailabilityRequest(_serialization.Model): + """Request body to get the availability for scheduling orders. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataBoxScheduleAvailabilityRequest, DiskScheduleAvailabilityRequest, + HeavyScheduleAvailabilityRequest + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + _subtype_map = { + "sku_name": { + "DataBox": "DataBoxScheduleAvailabilityRequest", + "DataBoxDisk": "DiskScheduleAvailabilityRequest", + "DataBoxHeavy": "HeavyScheduleAvailabilityRequest", + } + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name: Optional[str] = None + self.country = country + + +class DataBoxScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling data box orders orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBox" + + +class DataBoxSecret(_serialization.Model): + """The secrets related to a DataBox. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_serial_number: Serial number of the assigned device. + :vartype device_serial_number: str + :ivar device_password: Password for out of the box experience on device. + :vartype device_password: str + :ivar network_configurations: Network configuration of the appliance. + :vartype network_configurations: + list[~azure.mgmt.databox.v2023_03_01.models.ApplianceNetworkConfiguration] + :ivar encoded_validation_cert_pub_key: The base 64 encoded public key to authenticate with the + device. + :vartype encoded_validation_cert_pub_key: str + :ivar account_credential_details: Per account level access credentials. + :vartype account_credential_details: + list[~azure.mgmt.databox.v2023_03_01.models.AccountCredentialDetails] + """ + + _validation = { + "device_serial_number": {"readonly": True}, + "device_password": {"readonly": True}, + "network_configurations": {"readonly": True}, + "encoded_validation_cert_pub_key": {"readonly": True}, + "account_credential_details": {"readonly": True}, + } + + _attribute_map = { + "device_serial_number": {"key": "deviceSerialNumber", "type": "str"}, + "device_password": {"key": "devicePassword", "type": "str"}, + "network_configurations": {"key": "networkConfigurations", "type": "[ApplianceNetworkConfiguration]"}, + "encoded_validation_cert_pub_key": {"key": "encodedValidationCertPubKey", "type": "str"}, + "account_credential_details": {"key": "accountCredentialDetails", "type": "[AccountCredentialDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_serial_number = None + self.device_password = None + self.network_configurations = None + self.encoded_validation_cert_pub_key = None + self.account_credential_details = None + + +class DatacenterAddressResponse(_serialization.Model): + """Datacenter address for given storage location. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DatacenterAddressInstructionResponse, DatacenterAddressLocationResponse + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + } + + _subtype_map = { + "datacenter_address_type": { + "DatacenterAddressInstruction": "DatacenterAddressInstructionResponse", + "DatacenterAddressLocation": "DatacenterAddressLocationResponse", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: Optional[str] = None + self.supported_carriers_for_return_shipment = None + self.data_center_azure_location = None + + +class DatacenterAddressInstructionResponse(DatacenterAddressResponse): + """Datacenter instruction for given storage location. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar communication_instruction: Data center communication instruction. + :vartype communication_instruction: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "communication_instruction": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "communication_instruction": {"key": "communicationInstruction", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressInstruction" + self.communication_instruction = None + + +class DatacenterAddressLocationResponse(DatacenterAddressResponse): # pylint: disable=too-many-instance-attributes + """Datacenter address for given storage location. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar datacenter_address_type: Data center address type. Required. Known values are: + "DatacenterAddressLocation" and "DatacenterAddressInstruction". + :vartype datacenter_address_type: str or + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressType + :ivar supported_carriers_for_return_shipment: List of supported carriers for return shipment. + :vartype supported_carriers_for_return_shipment: list[str] + :ivar data_center_azure_location: Azure Location where the Data Center serves primarily. + :vartype data_center_azure_location: str + :ivar contact_person_name: Contact person name. + :vartype contact_person_name: str + :ivar company: Company name. + :vartype company: str + :ivar street1: Street address line 1. + :vartype street1: str + :ivar street2: Street address line 2. + :vartype street2: str + :ivar street3: Street address line 3. + :vartype street3: str + :ivar city: City name. + :vartype city: str + :ivar state: name of the state. + :vartype state: str + :ivar zip: Zip code. + :vartype zip: str + :ivar country: name of the country. + :vartype country: str + :ivar phone: Phone number. + :vartype phone: str + :ivar phone_extension: Phone extension. + :vartype phone_extension: str + :ivar address_type: Address type. + :vartype address_type: str + :ivar additional_shipping_information: Special instruction for shipping. + :vartype additional_shipping_information: str + """ + + _validation = { + "datacenter_address_type": {"required": True}, + "supported_carriers_for_return_shipment": {"readonly": True}, + "data_center_azure_location": {"readonly": True}, + "contact_person_name": {"readonly": True}, + "company": {"readonly": True}, + "street1": {"readonly": True}, + "street2": {"readonly": True}, + "street3": {"readonly": True}, + "city": {"readonly": True}, + "state": {"readonly": True}, + "zip": {"readonly": True}, + "country": {"readonly": True}, + "phone": {"readonly": True}, + "phone_extension": {"readonly": True}, + "address_type": {"readonly": True}, + "additional_shipping_information": {"readonly": True}, + } + + _attribute_map = { + "datacenter_address_type": {"key": "datacenterAddressType", "type": "str"}, + "supported_carriers_for_return_shipment": {"key": "supportedCarriersForReturnShipment", "type": "[str]"}, + "data_center_azure_location": {"key": "dataCenterAzureLocation", "type": "str"}, + "contact_person_name": {"key": "contactPersonName", "type": "str"}, + "company": {"key": "company", "type": "str"}, + "street1": {"key": "street1", "type": "str"}, + "street2": {"key": "street2", "type": "str"}, + "street3": {"key": "street3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "zip": {"key": "zip", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "phone": {"key": "phone", "type": "str"}, + "phone_extension": {"key": "phoneExtension", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "additional_shipping_information": {"key": "additionalShippingInformation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.datacenter_address_type: str = "DatacenterAddressLocation" + self.contact_person_name = None + self.company = None + self.street1 = None + self.street2 = None + self.street3 = None + self.city = None + self.state = None + self.zip = None + self.country = None + self.phone = None + self.phone_extension = None + self.address_type = None + self.additional_shipping_information = None + + +class DatacenterAddressRequest(_serialization.Model): + """Request body to get the datacenter address. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, storage_location: str, sku_name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: + """ + :keyword storage_location: Storage location. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword sku_name: Sku Name for which the data center address requested. Required. Known values + are: "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.storage_location = storage_location + self.sku_name = sku_name + + +class DataExportDetails(_serialization.Model): + """Details of the data to be used for exporting data from azure. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration: Configuration for the data transfer. Required. + :vartype transfer_configuration: ~azure.mgmt.databox.v2023_03_01.models.TransferConfiguration + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + """ + + _validation = { + "transfer_configuration": {"required": True}, + "account_details": {"required": True}, + } + + _attribute_map = { + "transfer_configuration": {"key": "transferConfiguration", "type": "TransferConfiguration"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + } + + def __init__( + self, + *, + transfer_configuration: "_models.TransferConfiguration", + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration: Configuration for the data transfer. Required. + :paramtype transfer_configuration: ~azure.mgmt.databox.v2023_03_01.models.TransferConfiguration + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + """ + super().__init__(**kwargs) + self.transfer_configuration = transfer_configuration + self.log_collection_level = log_collection_level + self.account_details = account_details + + +class DataImportDetails(_serialization.Model): + """Details of the data to be used for importing data to azure. + + All required parameters must be populated in order to send to Azure. + + :ivar account_details: Account details of the data to be transferred. Required. + :vartype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + :ivar log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :vartype log_collection_level: str or ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + """ + + _validation = { + "account_details": {"required": True}, + } + + _attribute_map = { + "account_details": {"key": "accountDetails", "type": "DataAccountDetails"}, + "log_collection_level": {"key": "logCollectionLevel", "type": "str"}, + } + + def __init__( + self, + *, + account_details: "_models.DataAccountDetails", + log_collection_level: Optional[Union[str, "_models.LogCollectionLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_details: Account details of the data to be transferred. Required. + :paramtype account_details: ~azure.mgmt.databox.v2023_03_01.models.DataAccountDetails + :keyword log_collection_level: Level of the logs to be collected. Known values are: "Error" and + "Verbose". + :paramtype log_collection_level: str or + ~azure.mgmt.databox.v2023_03_01.models.LogCollectionLevel + """ + super().__init__(**kwargs) + self.account_details = account_details + self.log_collection_level = log_collection_level + + +class DataLocationToServiceLocationMap(_serialization.Model): + """Map of data location to service location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_location: Location of the data. + :vartype data_location: str + :ivar service_location: Location of the service. + :vartype service_location: str + """ + + _validation = { + "data_location": {"readonly": True}, + "service_location": {"readonly": True}, + } + + _attribute_map = { + "data_location": {"key": "dataLocation", "type": "str"}, + "service_location": {"key": "serviceLocation", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.data_location = None + self.service_location = None + + +class DataTransferDetailsValidationRequest(ValidationInputRequest): + """Request to validate export and import data details. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar data_export_details: List of DataTransfer details to be used to export data from azure. + :vartype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :ivar data_import_details: List of DataTransfer details to be used to import data to azure. + :vartype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :ivar device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "data_export_details": {"key": "dataExportDetails", "type": "[DataExportDetails]"}, + "data_import_details": {"key": "dataImportDetails", "type": "[DataImportDetails]"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + data_export_details: Optional[List["_models.DataExportDetails"]] = None, + data_import_details: Optional[List["_models.DataImportDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_export_details: List of DataTransfer details to be used to export data from + azure. + :paramtype data_export_details: list[~azure.mgmt.databox.v2023_03_01.models.DataExportDetails] + :keyword data_import_details: List of DataTransfer details to be used to import data to azure. + :paramtype data_import_details: list[~azure.mgmt.databox.v2023_03_01.models.DataImportDetails] + :keyword device_type: Device type. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.data_export_details = data_export_details + self.data_import_details = data_import_details + self.device_type = device_type + self.transfer_type = transfer_type + + +class DataTransferDetailsValidationResponseProperties(ValidationInputResponse): + """Properties of data transfer details validation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Data transfer details validation status. Known values are: "Valid", "Invalid", + and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateDataTransferDetails" + self.status = None + + +class DcAccessSecurityCode(_serialization.Model): + """Dc access security code. + + :ivar reverse_dc_access_code: Reverse Dc access security code. + :vartype reverse_dc_access_code: str + :ivar forward_dc_access_code: Forward Dc access security code. + :vartype forward_dc_access_code: str + """ + + _attribute_map = { + "reverse_dc_access_code": {"key": "reverseDCAccessCode", "type": "str"}, + "forward_dc_access_code": {"key": "forwardDCAccessCode", "type": "str"}, + } + + def __init__( + self, + *, + reverse_dc_access_code: Optional[str] = None, + forward_dc_access_code: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword reverse_dc_access_code: Reverse Dc access security code. + :paramtype reverse_dc_access_code: str + :keyword forward_dc_access_code: Forward Dc access security code. + :paramtype forward_dc_access_code: str + """ + super().__init__(**kwargs) + self.reverse_dc_access_code = reverse_dc_access_code + self.forward_dc_access_code = forward_dc_access_code + + +class Details(_serialization.Model): + """Details. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class DeviceErasureDetails(_serialization.Model): + """Device erasure details with erasure completion status and erasureordestructionlog sas key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_erasure_status: Holds the device erasure completion status. Known values are: + "None", "InProgress", "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype device_erasure_status: str or ~azure.mgmt.databox.v2023_03_01.models.StageStatus + :ivar erasure_or_destruction_certificate_sas_key: Shared access key to download cleanup or + destruction certificate for device. + :vartype erasure_or_destruction_certificate_sas_key: str + """ + + _validation = { + "device_erasure_status": {"readonly": True}, + "erasure_or_destruction_certificate_sas_key": {"readonly": True}, + } + + _attribute_map = { + "device_erasure_status": {"key": "deviceErasureStatus", "type": "str"}, + "erasure_or_destruction_certificate_sas_key": {"key": "erasureOrDestructionCertificateSasKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.device_erasure_status = None + self.erasure_or_destruction_certificate_sas_key = None + + +class DiskScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling disk orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + :ivar expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :vartype expected_data_size_in_tera_bytes: int + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + "expected_data_size_in_tera_bytes": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "expected_data_size_in_tera_bytes": {"key": "expectedDataSizeInTeraBytes", "type": "int"}, + } + + def __init__( + self, + *, + storage_location: str, + expected_data_size_in_tera_bytes: int, + country: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + :keyword expected_data_size_in_tera_bytes: The expected size of the data, which needs to be + transferred in this job, in terabytes. Required. + :paramtype expected_data_size_in_tera_bytes: int + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxDisk" + self.expected_data_size_in_tera_bytes = expected_data_size_in_tera_bytes + + +class DiskSecret(_serialization.Model): + """Contains all the secrets of a Disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar disk_serial_number: Serial number of the assigned disk. + :vartype disk_serial_number: str + :ivar bit_locker_key: Bit Locker key of the disk which can be used to unlock the disk to copy + data. + :vartype bit_locker_key: str + """ + + _validation = { + "disk_serial_number": {"readonly": True}, + "bit_locker_key": {"readonly": True}, + } + + _attribute_map = { + "disk_serial_number": {"key": "diskSerialNumber", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.disk_serial_number = None + self.bit_locker_key = None + + +class EncryptionPreferences(_serialization.Model): + """Preferences related to the Encryption. + + :ivar double_encryption: Defines secondary layer of software-based encryption enablement. Known + values are: "Enabled" and "Disabled". + :vartype double_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.DoubleEncryption + :ivar hardware_encryption: Defines Hardware level encryption (Only for disk). Known values are: + "Enabled" and "Disabled". + :vartype hardware_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.HardwareEncryption + """ + + _attribute_map = { + "double_encryption": {"key": "doubleEncryption", "type": "str"}, + "hardware_encryption": {"key": "hardwareEncryption", "type": "str"}, + } + + def __init__( + self, + *, + double_encryption: Union[str, "_models.DoubleEncryption"] = "Disabled", + hardware_encryption: Optional[Union[str, "_models.HardwareEncryption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword double_encryption: Defines secondary layer of software-based encryption enablement. + Known values are: "Enabled" and "Disabled". + :paramtype double_encryption: str or ~azure.mgmt.databox.v2023_03_01.models.DoubleEncryption + :keyword hardware_encryption: Defines Hardware level encryption (Only for disk). Known values + are: "Enabled" and "Disabled". + :paramtype hardware_encryption: str or + ~azure.mgmt.databox.v2023_03_01.models.HardwareEncryption + """ + super().__init__(**kwargs) + self.double_encryption = double_encryption + self.hardware_encryption = hardware_encryption + + +class ErrorDetail(_serialization.Model): + """ErrorDetail. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar details: + :vartype details: list[~azure.mgmt.databox.v2023_03_01.models.Details] + :ivar target: + :vartype target: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[Details]"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, + *, + code: str, + message: str, + details: Optional[List["_models.Details"]] = None, + target: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Required. + :paramtype code: str + :keyword message: Required. + :paramtype message: str + :keyword details: + :paramtype details: list[~azure.mgmt.databox.v2023_03_01.models.Details] + :keyword target: + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + + +class ExportDiskDetails(_serialization.Model): + """Export disk details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar manifest_file: The relative path of the manifest file on the disk. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. + :vartype manifest_hash: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"readonly": True}, + "manifest_hash": {"readonly": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.manifest_file = None + self.manifest_hash = None + self.backup_manifest_cloud_path = None + + +class FilterFileDetails(_serialization.Model): + """Details of the filter files to be used for data transfer. + + All required parameters must be populated in order to send to Azure. + + :ivar filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :vartype filter_file_type: str or ~azure.mgmt.databox.v2023_03_01.models.FilterFileType + :ivar filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :vartype filter_file_path: str + """ + + _validation = { + "filter_file_type": {"required": True}, + "filter_file_path": {"required": True}, + } + + _attribute_map = { + "filter_file_type": {"key": "filterFileType", "type": "str"}, + "filter_file_path": {"key": "filterFilePath", "type": "str"}, + } + + def __init__( + self, *, filter_file_type: Union[str, "_models.FilterFileType"], filter_file_path: str, **kwargs: Any + ) -> None: + """ + :keyword filter_file_type: Type of the filter file. Required. Known values are: "AzureBlob" and + "AzureFile". + :paramtype filter_file_type: str or ~azure.mgmt.databox.v2023_03_01.models.FilterFileType + :keyword filter_file_path: Path of the file that contains the details of all items to transfer. + Required. + :paramtype filter_file_path: str + """ + super().__init__(**kwargs) + self.filter_file_type = filter_file_type + self.filter_file_path = filter_file_path + + +class HeavyScheduleAvailabilityRequest(ScheduleAvailabilityRequest): + """Request body to get the availability for scheduling heavy orders. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype storage_location: str + :ivar sku_name: Sku Name for which the order is to be scheduled. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar country: Country in which storage location should be supported. + :vartype country: str + """ + + _validation = { + "storage_location": {"required": True}, + "sku_name": {"required": True}, + } + + _attribute_map = { + "storage_location": {"key": "storageLocation", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "country": {"key": "country", "type": "str"}, + } + + def __init__(self, *, storage_location: str, country: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword storage_location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype storage_location: str + :keyword country: Country in which storage location should be supported. + :paramtype country: str + """ + super().__init__(storage_location=storage_location, country=country, **kwargs) + self.sku_name: str = "DataBoxHeavy" + + +class IdentityProperties(_serialization.Model): + """Managed identity properties. + + :ivar type: Managed service identity type. + :vartype type: str + :ivar user_assigned: User assigned identity properties. + :vartype user_assigned: ~azure.mgmt.databox.v2023_03_01.models.UserAssignedProperties + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "user_assigned": {"key": "userAssigned", "type": "UserAssignedProperties"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned: Optional["_models.UserAssignedProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Managed service identity type. + :paramtype type: str + :keyword user_assigned: User assigned identity properties. + :paramtype user_assigned: ~azure.mgmt.databox.v2023_03_01.models.UserAssignedProperties + """ + super().__init__(**kwargs) + self.type = type + self.user_assigned = user_assigned + + +class ImportDiskDetails(_serialization.Model): + """Import disk details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar manifest_file: The relative path of the manifest file on the disk. Required. + :vartype manifest_file: str + :ivar manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :vartype manifest_hash: str + :ivar bit_locker_key: BitLocker key used to encrypt the disk. Required. + :vartype bit_locker_key: str + :ivar backup_manifest_cloud_path: Path to backed up manifest, only returned if + enableManifestBackup is true. + :vartype backup_manifest_cloud_path: str + """ + + _validation = { + "manifest_file": {"required": True}, + "manifest_hash": {"required": True}, + "bit_locker_key": {"required": True}, + "backup_manifest_cloud_path": {"readonly": True}, + } + + _attribute_map = { + "manifest_file": {"key": "manifestFile", "type": "str"}, + "manifest_hash": {"key": "manifestHash", "type": "str"}, + "bit_locker_key": {"key": "bitLockerKey", "type": "str"}, + "backup_manifest_cloud_path": {"key": "backupManifestCloudPath", "type": "str"}, + } + + def __init__(self, *, manifest_file: str, manifest_hash: str, bit_locker_key: str, **kwargs: Any) -> None: + """ + :keyword manifest_file: The relative path of the manifest file on the disk. Required. + :paramtype manifest_file: str + :keyword manifest_hash: The Base16-encoded MD5 hash of the manifest file on the disk. Required. + :paramtype manifest_hash: str + :keyword bit_locker_key: BitLocker key used to encrypt the disk. Required. + :paramtype bit_locker_key: str + """ + super().__init__(**kwargs) + self.manifest_file = manifest_file + self.manifest_hash = manifest_hash + self.bit_locker_key = bit_locker_key + self.backup_manifest_cloud_path = None + + +class JobDelayDetails(_serialization.Model): + """Job Delay Notification details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Status of notification. Known values are: "Active" and "Resolved". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.DelayNotificationStatus + :ivar error_code: Delay Error code. Known values are: "InternalIssueDelay", + "ActiveOrderLimitBreachedDelay", "ActiveOrderLimitBreachedDelay", and + "ActiveOrderLimitBreachedDelay". + :vartype error_code: str or ~azure.mgmt.databox.v2023_03_01.models.PortalDelayErrorCode + :ivar description: Description of the delay. + :vartype description: str + :ivar start_time: Timestamp when the delay notification was created. + :vartype start_time: ~datetime.datetime + :ivar resolution_time: Timestamp when the delay notification was resolved. + :vartype resolution_time: ~datetime.datetime + """ + + _validation = { + "status": {"readonly": True}, + "error_code": {"readonly": True}, + "description": {"readonly": True}, + "start_time": {"readonly": True}, + "resolution_time": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "resolution_time": {"key": "resolutionTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.error_code = None + self.description = None + self.start_time = None + self.resolution_time = None + + +class JobDeliveryInfo(_serialization.Model): + """Additional delivery info. + + :ivar scheduled_date_time: Scheduled date time. + :vartype scheduled_date_time: ~datetime.datetime + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + } + + def __init__(self, *, scheduled_date_time: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_date_time: Scheduled date time. + :paramtype scheduled_date_time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + + +class Resource(_serialization.Model): + """Model of the Resource. + + All required parameters must be populated in order to send to Azure. + + :ivar location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + } + + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.sku = sku + self.identity = identity + + +class JobResource(Resource): # pylint: disable=too-many-instance-attributes + """Job Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar location: The location of the resource. This will be one of the supported and registered + Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be + changed once it is created, but if an identical region is specified on update the request will + succeed. Required. + :vartype location: str + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar sku: The sku type. Required. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :ivar name: Name of the object. + :vartype name: str + :ivar id: Id of the object. + :vartype id: str + :ivar type: Type of the object. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.databox.v2023_03_01.models.SystemData + :ivar transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar is_cancellable: Describes whether the job is cancellable or not. + :vartype is_cancellable: bool + :ivar is_deletable: Describes whether the job is deletable or not. + :vartype is_deletable: bool + :ivar is_shipping_address_editable: Describes whether the shipping address is editable or not. + :vartype is_shipping_address_editable: bool + :ivar reverse_shipping_details_update: The Editable status for Reverse Shipping Address and + Contact Info. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_shipping_details_update: str or + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetailsEditStatus + :ivar reverse_transport_preference_update: The Editable status for Reverse Transport + preferences. Known values are: "Enabled", "Disabled", and "NotSupported". + :vartype reverse_transport_preference_update: str or + ~azure.mgmt.databox.v2023_03_01.models.ReverseTransportPreferenceEditStatus + :ivar is_prepare_to_ship_enabled: Is Prepare To Ship Enabled on this job. + :vartype is_prepare_to_ship_enabled: bool + :ivar status: Name of the stage which is in progress. Known values are: "DeviceOrdered", + "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar delayed_stage: Name of the stage where delay might be present. Known values are: + "DeviceOrdered", "DevicePrepared", "Dispatched", "Delivered", "PickedUp", "AtAzureDC", + "DataCopy", "Completed", "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype delayed_stage: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar start_time: Time at which the job was started in UTC ISO 8601 format. + :vartype start_time: ~datetime.datetime + :ivar error: Top level error for the job. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar details: Details of a job run. This field will only be sent for expand details filter. + :vartype details: ~azure.mgmt.databox.v2023_03_01.models.JobDetails + :ivar cancellation_reason: Reason for cancellation. + :vartype cancellation_reason: str + :ivar delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :vartype delivery_type: str or ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryType + :ivar delivery_info: Delivery Info of Job. + :vartype delivery_info: ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryInfo + :ivar is_cancellable_without_fee: Flag to indicate cancellation of scheduled job. + :vartype is_cancellable_without_fee: bool + """ + + _validation = { + "location": {"required": True}, + "sku": {"required": True}, + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "transfer_type": {"required": True}, + "is_cancellable": {"readonly": True}, + "is_deletable": {"readonly": True}, + "is_shipping_address_editable": {"readonly": True}, + "reverse_shipping_details_update": {"readonly": True}, + "reverse_transport_preference_update": {"readonly": True}, + "is_prepare_to_ship_enabled": {"readonly": True}, + "status": {"readonly": True}, + "delayed_stage": {"readonly": True}, + "start_time": {"readonly": True}, + "error": {"readonly": True}, + "cancellation_reason": {"readonly": True}, + "is_cancellable_without_fee": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "transfer_type": {"key": "properties.transferType", "type": "str"}, + "is_cancellable": {"key": "properties.isCancellable", "type": "bool"}, + "is_deletable": {"key": "properties.isDeletable", "type": "bool"}, + "is_shipping_address_editable": {"key": "properties.isShippingAddressEditable", "type": "bool"}, + "reverse_shipping_details_update": {"key": "properties.reverseShippingDetailsUpdate", "type": "str"}, + "reverse_transport_preference_update": {"key": "properties.reverseTransportPreferenceUpdate", "type": "str"}, + "is_prepare_to_ship_enabled": {"key": "properties.isPrepareToShipEnabled", "type": "bool"}, + "status": {"key": "properties.status", "type": "str"}, + "delayed_stage": {"key": "properties.delayedStage", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "error": {"key": "properties.error", "type": "CloudError"}, + "details": {"key": "properties.details", "type": "JobDetails"}, + "cancellation_reason": {"key": "properties.cancellationReason", "type": "str"}, + "delivery_type": {"key": "properties.deliveryType", "type": "str"}, + "delivery_info": {"key": "properties.deliveryInfo", "type": "JobDeliveryInfo"}, + "is_cancellable_without_fee": {"key": "properties.isCancellableWithoutFee", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + sku: "_models.Sku", + transfer_type: Union[str, "_models.TransferType"], + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.JobDetails"] = None, + delivery_type: Union[str, "_models.JobDeliveryType"] = "NonScheduled", + delivery_info: Optional["_models.JobDeliveryInfo"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource. This will be one of the supported and + registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a + resource cannot be changed once it is created, but if an identical region is specified on + update the request will succeed. Required. + :paramtype location: str + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword sku: The sku type. Required. + :paramtype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :keyword transfer_type: Type of the data transfer. Required. Known values are: "ImportToAzure" + and "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword details: Details of a job run. This field will only be sent for expand details filter. + :paramtype details: ~azure.mgmt.databox.v2023_03_01.models.JobDetails + :keyword delivery_type: Delivery type of Job. Known values are: "NonScheduled" and "Scheduled". + :paramtype delivery_type: str or ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryType + :keyword delivery_info: Delivery Info of Job. + :paramtype delivery_info: ~azure.mgmt.databox.v2023_03_01.models.JobDeliveryInfo + """ + super().__init__(location=location, tags=tags, sku=sku, identity=identity, **kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.transfer_type = transfer_type + self.is_cancellable = None + self.is_deletable = None + self.is_shipping_address_editable = None + self.reverse_shipping_details_update = None + self.reverse_transport_preference_update = None + self.is_prepare_to_ship_enabled = None + self.status = None + self.delayed_stage = None + self.start_time = None + self.error = None + self.details = details + self.cancellation_reason = None + self.delivery_type = delivery_type + self.delivery_info = delivery_info + self.is_cancellable_without_fee = None + + +class JobResourceList(_serialization.Model): + """Job Resource Collection. + + :ivar value: List of job resources. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :ivar next_link: Link for the next set of job resources. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[JobResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.JobResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of job resources. + :paramtype value: list[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :keyword next_link: Link for the next set of job resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class JobResourceUpdateParameter(_serialization.Model): + """The JobResourceUpdateParameter. + + :ivar tags: The list of key value pairs that describe the resource. These tags can be used in + viewing and grouping this resource (across resource groups). + :vartype tags: dict[str, str] + :ivar identity: Msi identity of the resource. + :vartype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :ivar details: Details of a job to be updated. + :vartype details: ~azure.mgmt.databox.v2023_03_01.models.UpdateJobDetails + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ResourceIdentity"}, + "details": {"key": "properties.details", "type": "UpdateJobDetails"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceIdentity"] = None, + details: Optional["_models.UpdateJobDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The list of key value pairs that describe the resource. These tags can be used + in viewing and grouping this resource (across resource groups). + :paramtype tags: dict[str, str] + :keyword identity: Msi identity of the resource. + :paramtype identity: ~azure.mgmt.databox.v2023_03_01.models.ResourceIdentity + :keyword details: Details of a job to be updated. + :paramtype details: ~azure.mgmt.databox.v2023_03_01.models.UpdateJobDetails + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.details = details + + +class JobStages(_serialization.Model): + """Job stages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stage_name: Name of the job stage. Known values are: "DeviceOrdered", "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Completed", + "CompletedWithErrors", "Cancelled", "Failed_IssueReportedAtCustomer", + "Failed_IssueDetectedAtAzureDC", "Aborted", "CompletedWithWarnings", + "ReadyToDispatchFromAzureDC", "ReadyToReceiveAtAzureDC", "Created", "ShippedToAzureDC", + "AwaitingShipmentDetails", "PreparingToShipFromAzureDC", and "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.StageName + :ivar display_name: Display name of the job stage. + :vartype display_name: str + :ivar stage_status: Status of the job stage. Known values are: "None", "InProgress", + "Succeeded", "Failed", "Cancelled", "Cancelling", "SucceededWithErrors", + "WaitingForCustomerAction", "SucceededWithWarnings", "WaitingForCustomerActionForKek", + "WaitingForCustomerActionForCleanUp", "CustomerActionPerformedForCleanUp", and + "CustomerActionPerformed". + :vartype stage_status: str or ~azure.mgmt.databox.v2023_03_01.models.StageStatus + :ivar stage_time: Time for the job stage in UTC ISO 8601 format. + :vartype stage_time: ~datetime.datetime + :ivar job_stage_details: Job Stage Details. + :vartype job_stage_details: JSON + :ivar delay_information: Delay information for the job stages. + :vartype delay_information: list[~azure.mgmt.databox.v2023_03_01.models.JobDelayDetails] + """ + + _validation = { + "stage_name": {"readonly": True}, + "display_name": {"readonly": True}, + "stage_status": {"readonly": True}, + "stage_time": {"readonly": True}, + "job_stage_details": {"readonly": True}, + "delay_information": {"readonly": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "stage_status": {"key": "stageStatus", "type": "str"}, + "stage_time": {"key": "stageTime", "type": "iso-8601"}, + "job_stage_details": {"key": "jobStageDetails", "type": "object"}, + "delay_information": {"key": "delayInformation", "type": "[JobDelayDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.stage_name = None + self.display_name = None + self.stage_status = None + self.stage_time = None + self.job_stage_details = None + self.delay_information = None + + +class KeyEncryptionKey(_serialization.Model): + """Encryption key containing details about key to encrypt different keys. + + All required parameters must be populated in order to send to Azure. + + :ivar kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :vartype kek_type: str or ~azure.mgmt.databox.v2023_03_01.models.KekType + :ivar identity_properties: Managed identity properties used for key encryption. + :vartype identity_properties: ~azure.mgmt.databox.v2023_03_01.models.IdentityProperties + :ivar kek_url: Key encryption key. It is required in case of Customer managed KekType. + :vartype kek_url: str + :ivar kek_vault_resource_id: Kek vault resource id. It is required in case of Customer managed + KekType. + :vartype kek_vault_resource_id: str + """ + + _validation = { + "kek_type": {"required": True}, + } + + _attribute_map = { + "kek_type": {"key": "kekType", "type": "str"}, + "identity_properties": {"key": "identityProperties", "type": "IdentityProperties"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "kek_vault_resource_id": {"key": "kekVaultResourceID", "type": "str"}, + } + + def __init__( + self, + *, + kek_type: Union[str, "_models.KekType"] = "MicrosoftManaged", + identity_properties: Optional["_models.IdentityProperties"] = None, + kek_url: Optional[str] = None, + kek_vault_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kek_type: Type of encryption key used for key encryption. Known values are: + "MicrosoftManaged" and "CustomerManaged". + :paramtype kek_type: str or ~azure.mgmt.databox.v2023_03_01.models.KekType + :keyword identity_properties: Managed identity properties used for key encryption. + :paramtype identity_properties: ~azure.mgmt.databox.v2023_03_01.models.IdentityProperties + :keyword kek_url: Key encryption key. It is required in case of Customer managed KekType. + :paramtype kek_url: str + :keyword kek_vault_resource_id: Kek vault resource id. It is required in case of Customer + managed KekType. + :paramtype kek_vault_resource_id: str + """ + super().__init__(**kwargs) + self.kek_type = kek_type + self.identity_properties = identity_properties + self.kek_url = kek_url + self.kek_vault_resource_id = kek_vault_resource_id + + +class LastMitigationActionOnJob(_serialization.Model): + """Last Mitigation Action Performed On Job. + + :ivar action_date_time_in_utc: Action performed date time. + :vartype action_date_time_in_utc: ~datetime.datetime + :ivar is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :vartype is_performed_by_customer: bool + :ivar customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + """ + + _attribute_map = { + "action_date_time_in_utc": {"key": "actionDateTimeInUtc", "type": "iso-8601"}, + "is_performed_by_customer": {"key": "isPerformedByCustomer", "type": "bool"}, + "customer_resolution": {"key": "customerResolution", "type": "str"}, + } + + def __init__( + self, + *, + action_date_time_in_utc: Optional[datetime.datetime] = None, + is_performed_by_customer: Optional[bool] = None, + customer_resolution: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword action_date_time_in_utc: Action performed date time. + :paramtype action_date_time_in_utc: ~datetime.datetime + :keyword is_performed_by_customer: Action performed by customer, + possibility is that mitigation might happen by customer or service or by ops. + :paramtype is_performed_by_customer: bool + :keyword customer_resolution: Resolution code provided by customer. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + """ + super().__init__(**kwargs) + self.action_date_time_in_utc = action_date_time_in_utc + self.is_performed_by_customer = is_performed_by_customer + self.customer_resolution = customer_resolution + + +class ManagedDiskDetails(DataAccountDetails): + """Details of the managed disks. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar resource_group_id: Resource Group Id of the compute disks. Required. + :vartype resource_group_id: str + :ivar staging_storage_account_id: Resource Id of the storage account that can be used to copy + the vhd for staging. Required. + :vartype staging_storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "resource_group_id": {"required": True}, + "staging_storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "resource_group_id": {"key": "resourceGroupId", "type": "str"}, + "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, + } + + def __init__( + self, + *, + resource_group_id: str, + staging_storage_account_id: str, + share_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword resource_group_id: Resource Group Id of the compute disks. Required. + :paramtype resource_group_id: str + :keyword staging_storage_account_id: Resource Id of the storage account that can be used to + copy the vhd for staging. Required. + :paramtype staging_storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "ManagedDisk" + self.resource_group_id = resource_group_id + self.staging_storage_account_id = staging_storage_account_id + + +class MarkDevicesShippedRequest(_serialization.Model): + """The request body to provide the delivery package details of job. + + All required parameters must be populated in order to send to Azure. + + :ivar deliver_to_dc_package_details: Delivery package details. Required. + :vartype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + """ + + _validation = { + "deliver_to_dc_package_details": {"required": True}, + } + + _attribute_map = { + "deliver_to_dc_package_details": {"key": "deliverToDcPackageDetails", "type": "PackageCarrierInfo"}, + } + + def __init__(self, *, deliver_to_dc_package_details: "_models.PackageCarrierInfo", **kwargs: Any) -> None: + """ + :keyword deliver_to_dc_package_details: Delivery package details. Required. + :paramtype deliver_to_dc_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierInfo + """ + super().__init__(**kwargs) + self.deliver_to_dc_package_details = deliver_to_dc_package_details + + +class MitigateJobRequest(_serialization.Model): + """The Mitigate Job captured from request body for Mitigate API. + + :ivar customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :vartype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + :ivar serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :vartype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + + _attribute_map = { + "customer_resolution_code": {"key": "customerResolutionCode", "type": "str"}, + "serial_number_customer_resolution_map": {"key": "serialNumberCustomerResolutionMap", "type": "{str}"}, + } + + def __init__( + self, + *, + customer_resolution_code: Optional[Union[str, "_models.CustomerResolutionCode"]] = None, + serial_number_customer_resolution_map: Optional[Dict[str, Union[str, "_models.CustomerResolutionCode"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_resolution_code: Resolution code for the job. Known values are: "None", + "MoveToCleanUpDevice", "Resume", "Restart", and "ReachOutToOperation". + :paramtype customer_resolution_code: str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode + :keyword serial_number_customer_resolution_map: Serial number and the customer resolution code + corresponding to each serial number. + :paramtype serial_number_customer_resolution_map: dict[str, str or + ~azure.mgmt.databox.v2023_03_01.models.CustomerResolutionCode] + """ + super().__init__(**kwargs) + self.customer_resolution_code = customer_resolution_code + self.serial_number_customer_resolution_map = serial_number_customer_resolution_map + + +class NotificationPreference(_serialization.Model): + """Notification preference for a job stage. + + All required parameters must be populated in order to send to Azure. + + :ivar stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :vartype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.NotificationStageName + :ivar send_notification: Notification is required or not. + :vartype send_notification: bool + """ + + _validation = { + "stage_name": {"required": True}, + "send_notification": {"required": True}, + } + + _attribute_map = { + "stage_name": {"key": "stageName", "type": "str"}, + "send_notification": {"key": "sendNotification", "type": "bool"}, + } + + def __init__( + self, *, stage_name: Union[str, "_models.NotificationStageName"], send_notification: bool = True, **kwargs: Any + ) -> None: + """ + :keyword stage_name: Name of the stage. Required. Known values are: "DevicePrepared", + "Dispatched", "Delivered", "PickedUp", "AtAzureDC", "DataCopy", "Created", and + "ShippedToCustomer". + :paramtype stage_name: str or ~azure.mgmt.databox.v2023_03_01.models.NotificationStageName + :keyword send_notification: Notification is required or not. + :paramtype send_notification: bool + """ + super().__init__(**kwargs) + self.stage_name = stage_name + self.send_notification = send_notification + + +class Operation(_serialization.Model): + """Operation entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. Format: + {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}. + :vartype name: str + :ivar display: Operation display values. + :vartype display: ~azure.mgmt.databox.v2023_03_01.models.OperationDisplay + :ivar properties: Operation properties. + :vartype properties: JSON + :ivar origin: Origin of the operation. Can be : user|system|user,system. + :vartype origin: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + """ + + _validation = { + "name": {"readonly": True}, + "display": {"readonly": True}, + "properties": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "properties": {"key": "properties", "type": "object"}, + "origin": {"key": "origin", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + } + + def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ + super().__init__(**kwargs) + self.name = None + self.display = None + self.properties = None + self.origin = None + self.is_data_action = is_data_action + + +class OperationDisplay(_serialization.Model): + """Operation display. + + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str + :ivar operation: Localized name of the operation for display purpose. + :vartype operation: str + :ivar description: Localized description of the operation for display purpose. + :vartype description: str + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + :keyword operation: Localized name of the operation for display purpose. + :paramtype operation: str + :keyword description: Localized description of the operation for display purpose. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(_serialization.Model): + """Operation Collection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.Operation] + :ivar next_link: Link for the next set of operations. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link for the next set of operations. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class PackageCarrierDetails(_serialization.Model): + """Package carrier details. + + :ivar carrier_account_number: Carrier Account Number of customer for customer disk. + :vartype carrier_account_number: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_account_number": {"key": "carrierAccountNumber", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__( + self, + *, + carrier_account_number: Optional[str] = None, + carrier_name: Optional[str] = None, + tracking_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword carrier_account_number: Carrier Account Number of customer for customer disk. + :paramtype carrier_account_number: str + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_account_number = carrier_account_number + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageCarrierInfo(_serialization.Model): + """package carrier info. + + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _attribute_map = { + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, *, carrier_name: Optional[str] = None, tracking_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword carrier_name: Name of the carrier. + :paramtype carrier_name: str + :keyword tracking_id: Tracking Id of shipment. + :paramtype tracking_id: str + """ + super().__init__(**kwargs) + self.carrier_name = carrier_name + self.tracking_id = tracking_id + + +class PackageShippingDetails(_serialization.Model): + """package shipping details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tracking_url: Url where shipment can be tracked. + :vartype tracking_url: str + :ivar carrier_name: Name of the carrier. + :vartype carrier_name: str + :ivar tracking_id: Tracking Id of shipment. + :vartype tracking_id: str + """ + + _validation = { + "tracking_url": {"readonly": True}, + "carrier_name": {"readonly": True}, + "tracking_id": {"readonly": True}, + } + + _attribute_map = { + "tracking_url": {"key": "trackingUrl", "type": "str"}, + "carrier_name": {"key": "carrierName", "type": "str"}, + "tracking_id": {"key": "trackingId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tracking_url = None + self.carrier_name = None + self.tracking_id = None + + +class Preferences(_serialization.Model): + """Preferences related to the order. + + :ivar preferred_data_center_region: Preferred data center region. + :vartype preferred_data_center_region: list[str] + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :ivar reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :vartype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :ivar encryption_preferences: Preferences related to the Encryption. + :vartype encryption_preferences: ~azure.mgmt.databox.v2023_03_01.models.EncryptionPreferences + :ivar storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :vartype storage_account_access_tier_preferences: list[str] + """ + + _attribute_map = { + "preferred_data_center_region": {"key": "preferredDataCenterRegion", "type": "[str]"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + "reverse_transport_preferences": {"key": "reverseTransportPreferences", "type": "TransportPreferences"}, + "encryption_preferences": {"key": "encryptionPreferences", "type": "EncryptionPreferences"}, + "storage_account_access_tier_preferences": {"key": "storageAccountAccessTierPreferences", "type": "[str]"}, + } + + def __init__( + self, + *, + preferred_data_center_region: Optional[List[str]] = None, + transport_preferences: Optional["_models.TransportPreferences"] = None, + reverse_transport_preferences: Optional["_models.TransportPreferences"] = None, + encryption_preferences: Optional["_models.EncryptionPreferences"] = None, + storage_account_access_tier_preferences: Optional[List[Literal["Archive"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword preferred_data_center_region: Preferred data center region. + :paramtype preferred_data_center_region: list[str] + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :keyword reverse_transport_preferences: Optional Preferences related to the reverse shipment + logistics of the sku. + :paramtype reverse_transport_preferences: + ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + :keyword encryption_preferences: Preferences related to the Encryption. + :paramtype encryption_preferences: ~azure.mgmt.databox.v2023_03_01.models.EncryptionPreferences + :keyword storage_account_access_tier_preferences: Preferences related to the Access Tier of + storage accounts. + :paramtype storage_account_access_tier_preferences: list[str] + """ + super().__init__(**kwargs) + self.preferred_data_center_region = preferred_data_center_region + self.transport_preferences = transport_preferences + self.reverse_transport_preferences = reverse_transport_preferences + self.encryption_preferences = encryption_preferences + self.storage_account_access_tier_preferences = storage_account_access_tier_preferences + + +class PreferencesValidationRequest(ValidationInputRequest): + """Request to validate preference of transport and data center. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar preference: Preference of transport and data center. + :vartype preference: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "preference": {"key": "preference", "type": "Preferences"}, + "device_type": {"key": "deviceType", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + preference: Optional["_models.Preferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword preference: Preference of transport and data center. + :paramtype preference: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.preference = preference + self.device_type = device_type + + +class PreferencesValidationResponseProperties(ValidationInputResponse): + """Properties of data center and transport preference validation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Validation status of requested data center and transport. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidatePreferences" + self.status = None + + +class RegionConfigurationRequest(_serialization.Model): + """Request body to get the configuration for the region. + + :ivar schedule_availability_request: Request body to get the availability for scheduling + orders. + :vartype schedule_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityRequest + :ivar transport_availability_request: Request body to get the transport availability for given + sku. + :vartype transport_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityRequest + :ivar datacenter_address_request: Request body to get the datacenter address for given sku. + :vartype datacenter_address_request: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressRequest + """ + + _attribute_map = { + "schedule_availability_request": {"key": "scheduleAvailabilityRequest", "type": "ScheduleAvailabilityRequest"}, + "transport_availability_request": { + "key": "transportAvailabilityRequest", + "type": "TransportAvailabilityRequest", + }, + "datacenter_address_request": {"key": "datacenterAddressRequest", "type": "DatacenterAddressRequest"}, + } + + def __init__( + self, + *, + schedule_availability_request: Optional["_models.ScheduleAvailabilityRequest"] = None, + transport_availability_request: Optional["_models.TransportAvailabilityRequest"] = None, + datacenter_address_request: Optional["_models.DatacenterAddressRequest"] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_availability_request: Request body to get the availability for scheduling + orders. + :paramtype schedule_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityRequest + :keyword transport_availability_request: Request body to get the transport availability for + given sku. + :paramtype transport_availability_request: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityRequest + :keyword datacenter_address_request: Request body to get the datacenter address for given sku. + :paramtype datacenter_address_request: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressRequest + """ + super().__init__(**kwargs) + self.schedule_availability_request = schedule_availability_request + self.transport_availability_request = transport_availability_request + self.datacenter_address_request = datacenter_address_request + + +class RegionConfigurationResponse(_serialization.Model): + """Configuration response specific to a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar schedule_availability_response: Schedule availability for given sku in a region. + :vartype schedule_availability_response: + ~azure.mgmt.databox.v2023_03_01.models.ScheduleAvailabilityResponse + :ivar transport_availability_response: Transport options available for given sku in a region. + :vartype transport_availability_response: + ~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityResponse + :ivar datacenter_address_response: Datacenter address for given sku in a region. + :vartype datacenter_address_response: + ~azure.mgmt.databox.v2023_03_01.models.DatacenterAddressResponse + """ + + _validation = { + "schedule_availability_response": {"readonly": True}, + "transport_availability_response": {"readonly": True}, + "datacenter_address_response": {"readonly": True}, + } + + _attribute_map = { + "schedule_availability_response": { + "key": "scheduleAvailabilityResponse", + "type": "ScheduleAvailabilityResponse", + }, + "transport_availability_response": { + "key": "transportAvailabilityResponse", + "type": "TransportAvailabilityResponse", + }, + "datacenter_address_response": {"key": "datacenterAddressResponse", "type": "DatacenterAddressResponse"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.schedule_availability_response = None + self.transport_availability_response = None + self.datacenter_address_response = None + + +class ResourceIdentity(_serialization.Model): + """Msi identity details of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Identity type. + :vartype type: str + :ivar principal_id: Service Principal Id backing the Msi. + :vartype principal_id: str + :ivar tenant_id: Home Tenant Id. + :vartype tenant_id: str + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: str = "None", + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Identity type. + :paramtype type: str + :keyword user_assigned_identities: User Assigned Identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.databox.v2023_03_01.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None + self.user_assigned_identities = user_assigned_identities + + +class ReverseShippingDetails(_serialization.Model): + """Reverse Shipping Address and contact details for a job. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar contact_details: Contact Info. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactInfo + :ivar shipping_address: Shipping address where customer wishes to receive the device. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar is_updated: A flag to indicate whether Reverse Shipping details are updated or not after + device has been prepared. + Read only field. + :vartype is_updated: bool + """ + + _validation = { + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactInfo"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactInfo"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact Info. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactInfo + :keyword shipping_address: Shipping address where customer wishes to receive the device. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.is_updated = None + + +class ScheduleAvailabilityResponse(_serialization.Model): + """Schedule availability for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar available_dates: List of dates available to schedule. + :vartype available_dates: list[~datetime.datetime] + """ + + _validation = { + "available_dates": {"readonly": True}, + } + + _attribute_map = { + "available_dates": {"key": "availableDates", "type": "[iso-8601]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.available_dates = None + + +class ShareCredentialDetails(_serialization.Model): + """Credential details of the shares in account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar share_name: Name of the share. + :vartype share_name: str + :ivar share_type: Type of the share. Known values are: "UnknownType", "HCS", "BlockBlob", + "PageBlob", "AzureFile", and "ManagedDisk". + :vartype share_type: str or ~azure.mgmt.databox.v2023_03_01.models.ShareDestinationFormatType + :ivar user_name: User name for the share. + :vartype user_name: str + :ivar password: Password for the share. + :vartype password: str + :ivar supported_access_protocols: Access protocols supported on the device. + :vartype supported_access_protocols: list[str or + ~azure.mgmt.databox.v2023_03_01.models.AccessProtocol] + """ + + _validation = { + "share_name": {"readonly": True}, + "share_type": {"readonly": True}, + "user_name": {"readonly": True}, + "password": {"readonly": True}, + "supported_access_protocols": {"readonly": True}, + } + + _attribute_map = { + "share_name": {"key": "shareName", "type": "str"}, + "share_type": {"key": "shareType", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "supported_access_protocols": {"key": "supportedAccessProtocols", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.share_name = None + self.share_type = None + self.user_name = None + self.password = None + self.supported_access_protocols = None + + +class ShipmentPickUpRequest(_serialization.Model): + """Shipment pick up request details. + + All required parameters must be populated in order to send to Azure. + + :ivar start_time: Minimum date after which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype start_time: ~datetime.datetime + :ivar end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :vartype end_time: ~datetime.datetime + :ivar shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :vartype shipment_location: str + """ + + _validation = { + "start_time": {"required": True}, + "end_time": {"required": True}, + "shipment_location": {"required": True}, + } + + _attribute_map = { + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "shipment_location": {"key": "shipmentLocation", "type": "str"}, + } + + def __init__( + self, *, start_time: datetime.datetime, end_time: datetime.datetime, shipment_location: str, **kwargs: Any + ) -> None: + """ + :keyword start_time: Minimum date after which the pick up should commence, this must be in + local time of pick up area. Required. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Maximum date before which the pick up should commence, this must be in local + time of pick up area. Required. + :paramtype end_time: ~datetime.datetime + :keyword shipment_location: Shipment Location in the pickup place. Eg.front desk. Required. + :paramtype shipment_location: str + """ + super().__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + self.shipment_location = shipment_location + + +class ShipmentPickUpResponse(_serialization.Model): + """Shipment pick up response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confirmation_number: Confirmation number for the pick up request. + :vartype confirmation_number: str + :ivar ready_by_time: Time by which shipment should be ready for pick up, this is in local time + of pick up area. + :vartype ready_by_time: ~datetime.datetime + """ + + _validation = { + "confirmation_number": {"readonly": True}, + "ready_by_time": {"readonly": True}, + } + + _attribute_map = { + "confirmation_number": {"key": "confirmationNumber", "type": "str"}, + "ready_by_time": {"key": "readyByTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.confirmation_number = None + self.ready_by_time = None + + +class ShippingAddress(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Shipping address where customer wishes to receive the device. + + All required parameters must be populated in order to send to Azure. + + :ivar street_address1: Street Address line 1. Required. + :vartype street_address1: str + :ivar street_address2: Street Address line 2. + :vartype street_address2: str + :ivar street_address3: Street Address line 3. + :vartype street_address3: str + :ivar city: Name of the City. + :vartype city: str + :ivar state_or_province: Name of the State or Province. + :vartype state_or_province: str + :ivar country: Name of the Country. Required. + :vartype country: str + :ivar postal_code: Postal code. + :vartype postal_code: str + :ivar zip_extended_code: Extended Zip Code. + :vartype zip_extended_code: str + :ivar company_name: Name of the company. + :vartype company_name: str + :ivar address_type: Type of address. Known values are: "None", "Residential", and "Commercial". + :vartype address_type: str or ~azure.mgmt.databox.v2023_03_01.models.AddressType + :ivar skip_address_validation: Flag to indicate if customer has chosen to skip default address + validation. + :vartype skip_address_validation: bool + :ivar tax_identification_number: Tax Identification Number. + :vartype tax_identification_number: str + """ + + _validation = { + "street_address1": {"required": True}, + "country": {"required": True}, + } + + _attribute_map = { + "street_address1": {"key": "streetAddress1", "type": "str"}, + "street_address2": {"key": "streetAddress2", "type": "str"}, + "street_address3": {"key": "streetAddress3", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state_or_province": {"key": "stateOrProvince", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "postal_code": {"key": "postalCode", "type": "str"}, + "zip_extended_code": {"key": "zipExtendedCode", "type": "str"}, + "company_name": {"key": "companyName", "type": "str"}, + "address_type": {"key": "addressType", "type": "str"}, + "skip_address_validation": {"key": "skipAddressValidation", "type": "bool"}, + "tax_identification_number": {"key": "taxIdentificationNumber", "type": "str"}, + } + + def __init__( + self, + *, + street_address1: str, + country: str, + street_address2: Optional[str] = None, + street_address3: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + postal_code: Optional[str] = None, + zip_extended_code: Optional[str] = None, + company_name: Optional[str] = None, + address_type: Union[str, "_models.AddressType"] = "None", + skip_address_validation: Optional[bool] = None, + tax_identification_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword street_address1: Street Address line 1. Required. + :paramtype street_address1: str + :keyword street_address2: Street Address line 2. + :paramtype street_address2: str + :keyword street_address3: Street Address line 3. + :paramtype street_address3: str + :keyword city: Name of the City. + :paramtype city: str + :keyword state_or_province: Name of the State or Province. + :paramtype state_or_province: str + :keyword country: Name of the Country. Required. + :paramtype country: str + :keyword postal_code: Postal code. + :paramtype postal_code: str + :keyword zip_extended_code: Extended Zip Code. + :paramtype zip_extended_code: str + :keyword company_name: Name of the company. + :paramtype company_name: str + :keyword address_type: Type of address. Known values are: "None", "Residential", and + "Commercial". + :paramtype address_type: str or ~azure.mgmt.databox.v2023_03_01.models.AddressType + :keyword skip_address_validation: Flag to indicate if customer has chosen to skip default + address validation. + :paramtype skip_address_validation: bool + :keyword tax_identification_number: Tax Identification Number. + :paramtype tax_identification_number: str + """ + super().__init__(**kwargs) + self.street_address1 = street_address1 + self.street_address2 = street_address2 + self.street_address3 = street_address3 + self.city = city + self.state_or_province = state_or_province + self.country = country + self.postal_code = postal_code + self.zip_extended_code = zip_extended_code + self.company_name = company_name + self.address_type = address_type + self.skip_address_validation = skip_address_validation + self.tax_identification_number = tax_identification_number + + +class Sku(_serialization.Model): + """The Sku. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar display_name: The display name of the sku. + :vartype display_name: str + :ivar family: The sku family. + :vartype family: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "family": {"key": "family", "type": "str"}, + } + + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + display_name: Optional[str] = None, + family: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The sku name. Required. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword display_name: The display name of the sku. + :paramtype display_name: str + :keyword family: The sku family. + :paramtype family: str + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.family = family + + +class SkuAvailabilityValidationRequest(ValidationInputRequest): + """Request to validate sku availability. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :vartype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :ivar country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :vartype country: str + :ivar location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :vartype location: str + """ + + _validation = { + "validation_type": {"required": True}, + "device_type": {"required": True}, + "transfer_type": {"required": True}, + "country": {"required": True}, + "location": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transfer_type": {"key": "transferType", "type": "str"}, + "country": {"key": "country", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + device_type: Union[str, "_models.SkuName"], + transfer_type: Union[str, "_models.TransferType"], + country: str, + location: str, + **kwargs: Any + ) -> None: + """ + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transfer_type: Type of the transfer. Required. Known values are: "ImportToAzure" and + "ExportFromAzure". + :paramtype transfer_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransferType + :keyword country: ISO country code. Country for hardware shipment. For codes check: + https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. Required. + :paramtype country: str + :keyword location: Location for data transfer. For locations check: + https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.device_type = device_type + self.transfer_type = transfer_type + self.country = country + self.location = location + + +class SkuAvailabilityValidationResponseProperties(ValidationInputResponse): + """Properties of sku availability validation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Sku availability validation status. Known values are: "Valid", "Invalid", and + "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSkuAvailability" + self.status = None + + +class SkuCapacity(_serialization.Model): + """Capacity of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar usable: Usable capacity in TB. + :vartype usable: str + :ivar maximum: Maximum capacity in TB. + :vartype maximum: str + """ + + _validation = { + "usable": {"readonly": True}, + "maximum": {"readonly": True}, + } + + _attribute_map = { + "usable": {"key": "usable", "type": "str"}, + "maximum": {"key": "maximum", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.usable = None + self.maximum = None + + +class SkuCost(_serialization.Model): + """Describes metadata for retrieving price info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar meter_id: Meter id of the Sku. + :vartype meter_id: str + :ivar meter_type: The type of the meter. + :vartype meter_type: str + :ivar multiplier: Multiplier specifies the region specific value to be multiplied with 1$ guid. + Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to + region. + :vartype multiplier: float + """ + + _validation = { + "meter_id": {"readonly": True}, + "meter_type": {"readonly": True}, + "multiplier": {"readonly": True}, + } + + _attribute_map = { + "meter_id": {"key": "meterId", "type": "str"}, + "meter_type": {"key": "meterType", "type": "str"}, + "multiplier": {"key": "multiplier", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.meter_id = None + self.meter_type = None + self.multiplier = None + + +class SkuInformation(_serialization.Model): + """Information of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.databox.v2023_03_01.models.Sku + :ivar enabled: The sku is enabled or not. + :vartype enabled: bool + :ivar data_location_to_service_location_map: The map of data location to service location. + :vartype data_location_to_service_location_map: + list[~azure.mgmt.databox.v2023_03_01.models.DataLocationToServiceLocationMap] + :ivar capacity: Capacity of the Sku. + :vartype capacity: ~azure.mgmt.databox.v2023_03_01.models.SkuCapacity + :ivar costs: Cost of the Sku. + :vartype costs: list[~azure.mgmt.databox.v2023_03_01.models.SkuCost] + :ivar api_versions: Api versions that support this Sku. + :vartype api_versions: list[str] + :ivar disabled_reason: Reason why the Sku is disabled. Known values are: "None", "Country", + "Region", "Feature", "OfferType", and "NoSubscriptionInfo". + :vartype disabled_reason: str or ~azure.mgmt.databox.v2023_03_01.models.SkuDisabledReason + :ivar disabled_reason_message: Message for why the Sku is disabled. + :vartype disabled_reason_message: str + :ivar required_feature: Required feature to access the sku. + :vartype required_feature: str + :ivar countries_within_commerce_boundary: List of all the Countries in the SKU specific + commerce boundary. + :vartype countries_within_commerce_boundary: list[str] + """ + + _validation = { + "sku": {"readonly": True}, + "enabled": {"readonly": True}, + "data_location_to_service_location_map": {"readonly": True}, + "capacity": {"readonly": True}, + "costs": {"readonly": True}, + "api_versions": {"readonly": True}, + "disabled_reason": {"readonly": True}, + "disabled_reason_message": {"readonly": True}, + "required_feature": {"readonly": True}, + "countries_within_commerce_boundary": {"readonly": True}, + } + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "enabled": {"key": "enabled", "type": "bool"}, + "data_location_to_service_location_map": { + "key": "properties.dataLocationToServiceLocationMap", + "type": "[DataLocationToServiceLocationMap]", + }, + "capacity": {"key": "properties.capacity", "type": "SkuCapacity"}, + "costs": {"key": "properties.costs", "type": "[SkuCost]"}, + "api_versions": {"key": "properties.apiVersions", "type": "[str]"}, + "disabled_reason": {"key": "properties.disabledReason", "type": "str"}, + "disabled_reason_message": {"key": "properties.disabledReasonMessage", "type": "str"}, + "required_feature": {"key": "properties.requiredFeature", "type": "str"}, + "countries_within_commerce_boundary": {"key": "properties.countriesWithinCommerceBoundary", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sku = None + self.enabled = None + self.data_location_to_service_location_map = None + self.capacity = None + self.costs = None + self.api_versions = None + self.disabled_reason = None + self.disabled_reason_message = None + self.required_feature = None + self.countries_within_commerce_boundary = None + + +class StorageAccountDetails(DataAccountDetails): + """Details for the storage account. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Account Type of the data to be transferred. Required. Known values + are: "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :vartype share_password: str + :ivar storage_account_id: Storage Account Resource Id. Required. + :vartype storage_account_id: str + """ + + _validation = { + "data_account_type": {"required": True}, + "storage_account_id": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "share_password": {"key": "sharePassword", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + } + + def __init__(self, *, storage_account_id: str, share_password: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword share_password: Password for all the shares to be created on the device. Should not be + passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate + password itself. This will not be returned in Get Call. Password Requirements : Password must + be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase + alphabet, one number and one special character. Password cannot have the following characters : + IilLoO0 Password can have only alphabets, numbers and these characters : @#-$%^!+=;:_()]+. + :paramtype share_password: str + :keyword storage_account_id: Storage Account Resource Id. Required. + :paramtype storage_account_id: str + """ + super().__init__(share_password=share_password, **kwargs) + self.data_account_type: str = "StorageAccount" + self.storage_account_id = storage_account_id + + +class SubscriptionIsAllowedToCreateJobValidationRequest(ValidationInputRequest): + """Request to validate subscription permission to create jobs. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + """ + + _validation = { + "validation_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + + +class SubscriptionIsAllowedToCreateJobValidationResponseProperties(ValidationInputResponse): + """Properties of subscription permission to create job validation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation response. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar error: Error code and message of validation response. + :vartype error: ~azure.mgmt.databox.v2023_03_01.models.CloudError + :ivar status: Validation status of subscription permission to create job. Known values are: + "Valid", "Invalid", and "Skipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.ValidationStatus + """ + + _validation = { + "validation_type": {"required": True}, + "error": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "error": {"key": "error", "type": "CloudError"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateSubscriptionIsAllowedToCreateJob" + self.status = None + + +class SystemData(_serialization.Model): + """Provides details about resource creation and update time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_by: A string identifier for the identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource: user, application, + managedIdentity. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: A string identifier for the identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource: user, + application, managedIdentity. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + "created_by": {"readonly": True}, + "created_by_type": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_by": {"readonly": True}, + "last_modified_by_type": {"readonly": True}, + "last_modified_at": {"readonly": True}, + } + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_by = None + self.created_by_type = None + self.created_at = None + self.last_modified_by = None + self.last_modified_by_type = None + self.last_modified_at = None + + +class TransferAllDetails(_serialization.Model): + """Details to transfer all data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :vartype transfer_all_blobs: bool + :ivar transfer_all_files: To indicate if all Azure Files have to be transferred. + :vartype transfer_all_files: bool + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "transfer_all_blobs": {"key": "transferAllBlobs", "type": "bool"}, + "transfer_all_files": {"key": "transferAllFiles", "type": "bool"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + transfer_all_blobs: Optional[bool] = None, + transfer_all_files: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :keyword transfer_all_blobs: To indicate if all Azure blobs have to be transferred. + :paramtype transfer_all_blobs: bool + :keyword transfer_all_files: To indicate if all Azure Files have to be transferred. + :paramtype transfer_all_files: bool + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.transfer_all_blobs = transfer_all_blobs + self.transfer_all_files = transfer_all_files + + +class TransferConfiguration(_serialization.Model): + """Configuration for defining the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :vartype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationType + :ivar transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :vartype transfer_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferFilterDetails + :ivar transfer_all_details: Map of filter type and the details to transfer all data. This field + is required only if the TransferConfigurationType is given as TransferAll. + :vartype transfer_all_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferAllDetails + """ + + _validation = { + "transfer_configuration_type": {"required": True}, + } + + _attribute_map = { + "transfer_configuration_type": {"key": "transferConfigurationType", "type": "str"}, + "transfer_filter_details": { + "key": "transferFilterDetails", + "type": "TransferConfigurationTransferFilterDetails", + }, + "transfer_all_details": {"key": "transferAllDetails", "type": "TransferConfigurationTransferAllDetails"}, + } + + def __init__( + self, + *, + transfer_configuration_type: Union[str, "_models.TransferConfigurationType"], + transfer_filter_details: Optional["_models.TransferConfigurationTransferFilterDetails"] = None, + transfer_all_details: Optional["_models.TransferConfigurationTransferAllDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword transfer_configuration_type: Type of the configuration for transfer. Required. Known + values are: "TransferAll" and "TransferUsingFilter". + :paramtype transfer_configuration_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationType + :keyword transfer_filter_details: Map of filter type and the details to filter. This field is + required only if the TransferConfigurationType is given as TransferUsingFilter. + :paramtype transfer_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferFilterDetails + :keyword transfer_all_details: Map of filter type and the details to transfer all data. This + field is required only if the TransferConfigurationType is given as TransferAll. + :paramtype transfer_all_details: + ~azure.mgmt.databox.v2023_03_01.models.TransferConfigurationTransferAllDetails + """ + super().__init__(**kwargs) + self.transfer_configuration_type = transfer_configuration_type + self.transfer_filter_details = transfer_filter_details + self.transfer_all_details = transfer_all_details + + +class TransferConfigurationTransferAllDetails(_serialization.Model): + """Map of filter type and the details to transfer all data. This field is required only if the + TransferConfigurationType is given as TransferAll. + + :ivar include: Details to transfer all data. + :vartype include: ~azure.mgmt.databox.v2023_03_01.models.TransferAllDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferAllDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferAllDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details to transfer all data. + :paramtype include: ~azure.mgmt.databox.v2023_03_01.models.TransferAllDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferConfigurationTransferFilterDetails(_serialization.Model): + """Map of filter type and the details to filter. This field is required only if the + TransferConfigurationType is given as TransferUsingFilter. + + :ivar include: Details of the filtering the transfer of data. + :vartype include: ~azure.mgmt.databox.v2023_03_01.models.TransferFilterDetails + """ + + _attribute_map = { + "include": {"key": "include", "type": "TransferFilterDetails"}, + } + + def __init__(self, *, include: Optional["_models.TransferFilterDetails"] = None, **kwargs: Any) -> None: + """ + :keyword include: Details of the filtering the transfer of data. + :paramtype include: ~azure.mgmt.databox.v2023_03_01.models.TransferFilterDetails + """ + super().__init__(**kwargs) + self.include = include + + +class TransferFilterDetails(_serialization.Model): + """Details of the filtering the transfer of data. + + All required parameters must be populated in order to send to Azure. + + :ivar data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :vartype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :ivar blob_filter_details: Filter details to transfer blobs. + :vartype blob_filter_details: ~azure.mgmt.databox.v2023_03_01.models.BlobFilterDetails + :ivar azure_file_filter_details: Filter details to transfer Azure files. + :vartype azure_file_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.AzureFileFilterDetails + :ivar filter_file_details: Details of the filter files to be used for data transfer. + :vartype filter_file_details: list[~azure.mgmt.databox.v2023_03_01.models.FilterFileDetails] + """ + + _validation = { + "data_account_type": {"required": True}, + } + + _attribute_map = { + "data_account_type": {"key": "dataAccountType", "type": "str"}, + "blob_filter_details": {"key": "blobFilterDetails", "type": "BlobFilterDetails"}, + "azure_file_filter_details": {"key": "azureFileFilterDetails", "type": "AzureFileFilterDetails"}, + "filter_file_details": {"key": "filterFileDetails", "type": "[FilterFileDetails]"}, + } + + def __init__( + self, + *, + data_account_type: Union[str, "_models.DataAccountType"], + blob_filter_details: Optional["_models.BlobFilterDetails"] = None, + azure_file_filter_details: Optional["_models.AzureFileFilterDetails"] = None, + filter_file_details: Optional[List["_models.FilterFileDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_account_type: Type of the account of data. Required. Known values are: + "StorageAccount" and "ManagedDisk". + :paramtype data_account_type: str or ~azure.mgmt.databox.v2023_03_01.models.DataAccountType + :keyword blob_filter_details: Filter details to transfer blobs. + :paramtype blob_filter_details: ~azure.mgmt.databox.v2023_03_01.models.BlobFilterDetails + :keyword azure_file_filter_details: Filter details to transfer Azure files. + :paramtype azure_file_filter_details: + ~azure.mgmt.databox.v2023_03_01.models.AzureFileFilterDetails + :keyword filter_file_details: Details of the filter files to be used for data transfer. + :paramtype filter_file_details: list[~azure.mgmt.databox.v2023_03_01.models.FilterFileDetails] + """ + super().__init__(**kwargs) + self.data_account_type = data_account_type + self.blob_filter_details = blob_filter_details + self.azure_file_filter_details = azure_file_filter_details + self.filter_file_details = filter_file_details + + +class TransportAvailabilityDetails(_serialization.Model): + """Transport options availability details for given region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar shipment_type: Transport Shipment Type supported for given region. Known values are: + "CustomerManaged" and "MicrosoftManaged". + :vartype shipment_type: str or ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + """ + + _validation = { + "shipment_type": {"readonly": True}, + } + + _attribute_map = { + "shipment_type": {"key": "shipmentType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shipment_type = None + + +class TransportAvailabilityRequest(_serialization.Model): + """Request body to get the transport availability for given sku. + + :ivar sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", "DataBoxHeavy", + and "DataBoxCustomerDisk". + :vartype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + + _attribute_map = { + "sku_name": {"key": "skuName", "type": "str"}, + } + + def __init__(self, *, sku_name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: + """ + :keyword sku_name: Type of the device. Known values are: "DataBox", "DataBoxDisk", + "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype sku_name: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + """ + super().__init__(**kwargs) + self.sku_name = sku_name + + +class TransportAvailabilityResponse(_serialization.Model): + """Transport options available for given sku in a region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar transport_availability_details: List of transport availability details for given region. + :vartype transport_availability_details: + list[~azure.mgmt.databox.v2023_03_01.models.TransportAvailabilityDetails] + """ + + _validation = { + "transport_availability_details": {"readonly": True}, + } + + _attribute_map = { + "transport_availability_details": { + "key": "transportAvailabilityDetails", + "type": "[TransportAvailabilityDetails]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.transport_availability_details = None + + +class TransportPreferences(_serialization.Model): + """Preferences related to the shipment logistics of the sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar preferred_shipment_type: Indicates Shipment Logistics type that the customer preferred. + Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :vartype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + :ivar is_updated: Read only property which indicates whether transport preferences has been + updated or not after device is prepared. + :vartype is_updated: bool + """ + + _validation = { + "preferred_shipment_type": {"required": True}, + "is_updated": {"readonly": True}, + } + + _attribute_map = { + "preferred_shipment_type": {"key": "preferredShipmentType", "type": "str"}, + "is_updated": {"key": "isUpdated", "type": "bool"}, + } + + def __init__(self, *, preferred_shipment_type: Union[str, "_models.TransportShipmentTypes"], **kwargs: Any) -> None: + """ + :keyword preferred_shipment_type: Indicates Shipment Logistics type that the customer + preferred. Required. Known values are: "CustomerManaged" and "MicrosoftManaged". + :paramtype preferred_shipment_type: str or + ~azure.mgmt.databox.v2023_03_01.models.TransportShipmentTypes + """ + super().__init__(**kwargs) + self.preferred_shipment_type = preferred_shipment_type + self.is_updated = None + + +class UnencryptedCredentials(_serialization.Model): + """Unencrypted credentials for accessing device. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_name: Name of the job. + :vartype job_name: str + :ivar job_secrets: Secrets related to this job. + :vartype job_secrets: ~azure.mgmt.databox.v2023_03_01.models.JobSecrets + """ + + _validation = { + "job_name": {"readonly": True}, + "job_secrets": {"readonly": True}, + } + + _attribute_map = { + "job_name": {"key": "jobName", "type": "str"}, + "job_secrets": {"key": "jobSecrets", "type": "JobSecrets"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.job_name = None + self.job_secrets = None + + +class UnencryptedCredentialsList(_serialization.Model): + """List of unencrypted credentials for accessing device. + + :ivar value: List of unencrypted credentials. + :vartype value: list[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :ivar next_link: Link for the next set of unencrypted credentials. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[UnencryptedCredentials]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.UnencryptedCredentials"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of unencrypted credentials. + :paramtype value: list[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :keyword next_link: Link for the next set of unencrypted credentials. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateJobDetails(_serialization.Model): + """Job details for update. + + :ivar contact_details: Contact details for notification and shipping. + :vartype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :ivar shipping_address: Shipping address of the customer. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :vartype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :ivar preferences: Preferences related to the order. + :vartype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :ivar key_encryption_key: Key encryption key for the job. + :vartype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :ivar return_to_customer_package_details: Return package details of job. + :vartype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + """ + + _attribute_map = { + "contact_details": {"key": "contactDetails", "type": "ContactDetails"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "reverse_shipping_details": {"key": "reverseShippingDetails", "type": "ReverseShippingDetails"}, + "preferences": {"key": "preferences", "type": "Preferences"}, + "key_encryption_key": {"key": "keyEncryptionKey", "type": "KeyEncryptionKey"}, + "return_to_customer_package_details": { + "key": "returnToCustomerPackageDetails", + "type": "PackageCarrierDetails", + }, + } + + def __init__( + self, + *, + contact_details: Optional["_models.ContactDetails"] = None, + shipping_address: Optional["_models.ShippingAddress"] = None, + reverse_shipping_details: Optional["_models.ReverseShippingDetails"] = None, + preferences: Optional["_models.Preferences"] = None, + key_encryption_key: Optional["_models.KeyEncryptionKey"] = None, + return_to_customer_package_details: Optional["_models.PackageCarrierDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword contact_details: Contact details for notification and shipping. + :paramtype contact_details: ~azure.mgmt.databox.v2023_03_01.models.ContactDetails + :keyword shipping_address: Shipping address of the customer. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword reverse_shipping_details: Reverse Shipping Address and contact details for a job. + :paramtype reverse_shipping_details: + ~azure.mgmt.databox.v2023_03_01.models.ReverseShippingDetails + :keyword preferences: Preferences related to the order. + :paramtype preferences: ~azure.mgmt.databox.v2023_03_01.models.Preferences + :keyword key_encryption_key: Key encryption key for the job. + :paramtype key_encryption_key: ~azure.mgmt.databox.v2023_03_01.models.KeyEncryptionKey + :keyword return_to_customer_package_details: Return package details of job. + :paramtype return_to_customer_package_details: + ~azure.mgmt.databox.v2023_03_01.models.PackageCarrierDetails + """ + super().__init__(**kwargs) + self.contact_details = contact_details + self.shipping_address = shipping_address + self.reverse_shipping_details = reverse_shipping_details + self.preferences = preferences + self.key_encryption_key = key_encryption_key + self.return_to_customer_package_details = return_to_customer_package_details + + +class UserAssignedIdentity(_serialization.Model): + """Class defining User assigned identity details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserAssignedProperties(_serialization.Model): + """User assigned identity properties. + + :ivar resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: Arm resource id for user assigned identity to be used to fetch MSI token. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class ValidateAddress(ValidationInputRequest): + """The requirements to validate customer address where the device needs to be shipped. + + All required parameters must be populated in order to send to Azure. + + :ivar validation_type: Identifies the type of validation request. Required. Known values are: + "ValidateAddress", "ValidateSubscriptionIsAllowedToCreateJob", "ValidatePreferences", + "ValidateCreateOrderLimit", "ValidateSkuAvailability", and "ValidateDataTransferDetails". + :vartype validation_type: str or + ~azure.mgmt.databox.v2023_03_01.models.ValidationInputDiscriminator + :ivar shipping_address: Shipping address of the customer. Required. + :vartype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :ivar device_type: Device type to be used for the job. Required. Known values are: "DataBox", + "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :vartype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :ivar transport_preferences: Preferences related to the shipment logistics of the sku. + :vartype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + """ + + _validation = { + "validation_type": {"required": True}, + "shipping_address": {"required": True}, + "device_type": {"required": True}, + } + + _attribute_map = { + "validation_type": {"key": "validationType", "type": "str"}, + "shipping_address": {"key": "shippingAddress", "type": "ShippingAddress"}, + "device_type": {"key": "deviceType", "type": "str"}, + "transport_preferences": {"key": "transportPreferences", "type": "TransportPreferences"}, + } + + def __init__( + self, + *, + shipping_address: "_models.ShippingAddress", + device_type: Union[str, "_models.SkuName"], + transport_preferences: Optional["_models.TransportPreferences"] = None, + **kwargs: Any + ) -> None: + """ + :keyword shipping_address: Shipping address of the customer. Required. + :paramtype shipping_address: ~azure.mgmt.databox.v2023_03_01.models.ShippingAddress + :keyword device_type: Device type to be used for the job. Required. Known values are: + "DataBox", "DataBoxDisk", "DataBoxHeavy", and "DataBoxCustomerDisk". + :paramtype device_type: str or ~azure.mgmt.databox.v2023_03_01.models.SkuName + :keyword transport_preferences: Preferences related to the shipment logistics of the sku. + :paramtype transport_preferences: ~azure.mgmt.databox.v2023_03_01.models.TransportPreferences + """ + super().__init__(**kwargs) + self.validation_type: str = "ValidateAddress" + self.shipping_address = shipping_address + self.device_type = device_type + self.transport_preferences = transport_preferences + + +class ValidationResponse(_serialization.Model): + """Response of pre job creation validations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Overall validation status. Known values are: "AllValidToProceed", + "InputsRevisitRequired", and "CertainInputValidationsSkipped". + :vartype status: str or ~azure.mgmt.databox.v2023_03_01.models.OverallValidationStatus + :ivar individual_response_details: List of response details contain validationType and its + response as key and value respectively. + :vartype individual_response_details: + list[~azure.mgmt.databox.v2023_03_01.models.ValidationInputResponse] + """ + + _validation = { + "status": {"readonly": True}, + "individual_response_details": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "properties.status", "type": "str"}, + "individual_response_details": { + "key": "properties.individualResponseDetails", + "type": "[ValidationInputResponse]", + }, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status = None + self.individual_response_details = None diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py new file mode 100644 index 000000000000..d44a1996902a --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._operations import Operations +from ._jobs_operations import JobsOperations +from ._data_box_management_client_operations import DataBoxManagementClientOperationsMixin +from ._service_operations import ServiceOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "JobsOperations", + "DataBoxManagementClientOperationsMixin", + "ServiceOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py new file mode 100644 index 000000000000..5807f066bf0e --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_data_box_management_client_operations.py @@ -0,0 +1,219 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_mitigate_request(job_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataBoxManagementClientOperationsMixin(DataBoxManagementClientMixinABC): + def _api_version(self, op_name: str) -> str: # pylint: disable=unused-argument + try: + return self._config.api_version + except: # pylint: disable=bare-except + return "" + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: _models.MitigateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Required. + :type mitigate_job_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mitigate( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mitigate_job_request: Union[_models.MitigateJobRequest, IO], + **kwargs: Any + ) -> None: + """Request to mitigate for a given job. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mitigate_job_request: Mitigation Request. Is either a MitigateJobRequest type or a IO + type. Required. + :type mitigate_job_request: ~azure.mgmt.databox.v2023_03_01.models.MitigateJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version("mitigate") or "2023-03-01") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(mitigate_job_request, (IOBase, bytes)): + _content = mitigate_job_request + else: + _json = self._serialize.body(mitigate_job_request, "MitigateJobRequest") + + request = build_mitigate_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mitigate.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mitigate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/mitigate" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py new file mode 100644 index 000000000000..8d3656f77159 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_jobs_operations.py @@ -0,0 +1,1741 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mark_devices_shipped_request( + job_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped", + ) # pylint: disable=line-too-long + path_format_arguments = { + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, job_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, job_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_book_shipment_pick_up_request( + resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cancel_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_credentials_request( + resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str", max_length=24, min_length=3, pattern=r"^[-\w\.]+$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the subscription. + + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs"} + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: _models.MarkDevicesShippedRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Required. + :type mark_devices_shipped_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def mark_devices_shipped( # pylint: disable=inconsistent-return-statements + self, + job_name: str, + resource_group_name: str, + mark_devices_shipped_request: Union[_models.MarkDevicesShippedRequest, IO], + **kwargs: Any + ) -> None: + """Request to mark devices for a given job as shipped. + + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param mark_devices_shipped_request: Mark Devices Shipped Request. Is either a + MarkDevicesShippedRequest type or a IO type. Required. + :type mark_devices_shipped_request: + ~azure.mgmt.databox.v2023_03_01.models.MarkDevicesShippedRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(mark_devices_shipped_request, (IOBase, bytes)): + _content = mark_devices_shipped_request + else: + _json = self._serialize.body(mark_devices_shipped_request, "MarkDevicesShippedRequest") + + request = build_mark_devices_shipped_request( + job_name=job_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.mark_devices_shipped.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + mark_devices_shipped.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/markDevicesShipped" + } + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.JobResource"]: + """Lists all the jobs available under the given resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param skip_token: $skipToken is supported on Get list of jobs, which provides the next page in + the list of jobs. Default value is None. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JobResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs" + } + + @distributed_trace + def get( + self, resource_group_name: str, job_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.JobResource: + """Gets information about the specified job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param expand: $expand is supported on details parameter for job, which provides details on the + job stages. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _create_initial( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource, (IOBase, bytes)): + _content = job_resource + else: + _json = self._serialize.body(job_resource, "JobResource") + + request = build_create_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: _models.JobResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + job_name: str, + job_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Required. + :type job_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, job_name: str, job_resource: Union[_models.JobResource, IO], **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Creates a new job with the specified parameters. Existing job cannot be updated with this API + and should instead be updated with the Update job API. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource: Job details from request body. Is either a JobResource type or a IO type. + Required. + :type job_resource: ~azure.mgmt.databox.v2023_03_01.models.JobResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + job_name=job_name, + job_resource=job_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + def _update_initial( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional[_models.JobResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JobResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_resource_update_parameter, (IOBase, bytes)): + _content = job_resource_update_parameter + else: + _json = self._serialize.body(job_resource_update_parameter, "JobResourceUpdateParameter") + + request = build_update_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JobResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: _models.JobResourceUpdateParameter, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Required. + :type job_resource_update_parameter: IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + job_name: str, + job_resource_update_parameter: Union[_models.JobResourceUpdateParameter, IO], + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.JobResource]: + """Updates the properties of an existing job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param job_resource_update_parameter: Job update parameters from request body. Is either a + JobResourceUpdateParameter type or a IO type. Required. + :type job_resource_update_parameter: + ~azure.mgmt.databox.v2023_03_01.models.JobResourceUpdateParameter or IO + :param if_match: Defines the If-Match condition. The patch will be performed only if the ETag + of the job on the server matches this value. Default value is None. + :type if_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either JobResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.databox.v2023_03_01.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + job_name=job_name, + job_resource_update_parameter=job_resource_update_parameter, + if_match=if_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JobResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}" + } + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: _models.ShipmentPickUpRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Required. + :type shipment_pick_up_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def book_shipment_pick_up( + self, + resource_group_name: str, + job_name: str, + shipment_pick_up_request: Union[_models.ShipmentPickUpRequest, IO], + **kwargs: Any + ) -> _models.ShipmentPickUpResponse: + """Book shipment pick up. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param shipment_pick_up_request: Details of shipment pick up request. Is either a + ShipmentPickUpRequest type or a IO type. Required. + :type shipment_pick_up_request: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShipmentPickUpResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ShipmentPickUpResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ShipmentPickUpResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shipment_pick_up_request, (IOBase, bytes)): + _content = shipment_pick_up_request + else: + _json = self._serialize.body(shipment_pick_up_request, "ShipmentPickUpRequest") + + request = build_book_shipment_pick_up_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.book_shipment_pick_up.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ShipmentPickUpResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + book_shipment_pick_up.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp" + } + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: _models.CancellationReason, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Required. + :type cancellation_reason: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + job_name: str, + cancellation_reason: Union[_models.CancellationReason, IO], + **kwargs: Any + ) -> None: + """CancelJob. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :param cancellation_reason: Reason for cancellation. Is either a CancellationReason type or a + IO type. Required. + :type cancellation_reason: ~azure.mgmt.databox.v2023_03_01.models.CancellationReason or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cancellation_reason, (IOBase, bytes)): + _content = cancellation_reason + else: + _json = self._serialize.body(cancellation_reason, "CancellationReason") + + request = build_cancel_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.cancel.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel" + } + + @distributed_trace + def list_credentials( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> Iterable["_models.UnencryptedCredentials"]: + """This method gets the unencrypted secrets related to the job. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param job_name: The name of the job Resource within the specified resource group. job names + must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + Required. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UnencryptedCredentials or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.UnencryptedCredentials] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.UnencryptedCredentialsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UnencryptedCredentialsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_credentials.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py new file mode 100644 index 000000000000..fb1a22130444 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_operations.py @@ -0,0 +1,156 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DataBox/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """This method gets all the operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.DataBox/operations"} diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py new file mode 100644 index 000000000000..1cbbe77dee73 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/operations/_service_operations.py @@ -0,0 +1,1085 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import DataBoxManagementClientMixinABC, _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_available_skus_by_resource_group_request( + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_address_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_inputs_by_resource_group_request( + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_inputs_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_region_configuration_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_region_configuration_by_resource_group_request( + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServiceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.databox.v2023_03_01.DataBoxManagementClient`'s + :attr:`service` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: _models.AvailableSkuRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Required. + :type available_sku_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_available_skus_by_resource_group( + self, + resource_group_name: str, + location: str, + available_sku_request: Union[_models.AvailableSkuRequest, IO], + **kwargs: Any + ) -> Iterable["_models.SkuInformation"]: + """This method provides the list of available skus for the given subscription, resource group and + location. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param available_sku_request: Filters for showing the available skus. Is either a + AvailableSkuRequest type or a IO type. Required. + :type available_sku_request: ~azure.mgmt.databox.v2023_03_01.models.AvailableSkuRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuInformation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.databox.v2023_03_01.models.SkuInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AvailableSkusResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(available_sku_request, (IOBase, bytes)): + _content = available_sku_request + else: + _json = self._serialize.body(available_sku_request, "AvailableSkuRequest") + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_available_skus_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.list_available_skus_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableSkusResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_available_skus_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus" + } + + @overload + def validate_address( + self, + location: str, + validate_address: _models.ValidateAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_address( + self, location: str, validate_address: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Required. + :type validate_address: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_address( + self, location: str, validate_address: Union[_models.ValidateAddress, IO], **kwargs: Any + ) -> _models.AddressValidationOutput: + """[DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer + shipping address and provide alternate addresses if any. + + :param location: The location of the resource. Required. + :type location: str + :param validate_address: Shipping address of the customer. Is either a ValidateAddress type or + a IO type. Required. + :type validate_address: ~azure.mgmt.databox.v2023_03_01.models.ValidateAddress or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AddressValidationOutput or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.AddressValidationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AddressValidationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_address, (IOBase, bytes)): + _content = validate_address + else: + _json = self._serialize.body(validate_address, "ValidateAddress") + + request = build_validate_address_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_address.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AddressValidationOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_address.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress" + } + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs_by_resource_group( + self, + resource_group_name: str, + location: str, + validation_request: Union[_models.ValidationRequest, IO], + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under resource group. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def validate_inputs( + self, + location: str, + validation_request: _models.ValidationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_inputs( + self, location: str, validation_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Required. + :type validation_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_inputs( + self, location: str, validation_request: Union[_models.ValidationRequest, IO], **kwargs: Any + ) -> _models.ValidationResponse: + """This method does all necessary pre-job creation validation under subscription. + + :param location: The location of the resource. Required. + :type location: str + :param validation_request: Inputs of the customer. Is either a ValidationRequest type or a IO + type. Required. + :type validation_request: ~azure.mgmt.databox.v2023_03_01.models.ValidationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.ValidationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validation_request, (IOBase, bytes)): + _content = validation_request + else: + _json = self._serialize.body(validation_request, "ValidationRequest") + + request = build_validate_inputs_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.validate_inputs.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_inputs.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs" + } + + @overload + def region_configuration( + self, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration( + self, location: str, region_configuration_request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. + Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration( + self, location: str, region_configuration_request: Union[_models.RegionConfigurationRequest, IO], **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Subscription + level. + + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region. Is + either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: _models.RegionConfigurationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Required. + :type region_configuration_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def region_configuration_by_resource_group( + self, + resource_group_name: str, + location: str, + region_configuration_request: Union[_models.RegionConfigurationRequest, IO], + **kwargs: Any + ) -> _models.RegionConfigurationResponse: + """This API provides configuration details specific to given region/location at Resource group + level. + + :param resource_group_name: The Resource Group Name. Required. + :type resource_group_name: str + :param location: The location of the resource. Required. + :type location: str + :param region_configuration_request: Request body to get the configuration for the region at + resource group level. Is either a RegionConfigurationRequest type or a IO type. Required. + :type region_configuration_request: + ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionConfigurationResponse or the result of cls(response) + :rtype: ~azure.mgmt.databox.v2023_03_01.models.RegionConfigurationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegionConfigurationResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(region_configuration_request, (IOBase, bytes)): + _content = region_configuration_request + else: + _json = self._serialize.body(region_configuration_request, "RegionConfigurationRequest") + + request = build_region_configuration_by_resource_group_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.region_configuration_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ApiError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RegionConfigurationResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + region_configuration_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration" + } diff --git a/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2023_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py index c4588de66fd2..56d0113f24a3 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/available_skus_post.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/AvailableSkusPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/AvailableSkusPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py index 3697bce7c2f2..4f9a37d1834e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/book_shipment_pickup_post.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/BookShipmentPickupPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/BookShipmentPickupPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py b/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py index 39455180d133..14c6c83e749e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/job_mitigate.py @@ -29,16 +29,15 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.mitigate( + client.mitigate( job_name="TestJobName1", resource_group_name="YourResourceGroupName", mitigate_job_request={ "serialNumberCustomerResolutionMap": {"testDISK-1": "MoveToCleanUpDevice", "testDISK-2": "Resume"} }, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobMitigate.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobMitigate.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py index 0ae513ad4aa2..308c58a9370c 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_cancel_post.py @@ -29,14 +29,13 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.cancel( + client.jobs.cancel( resource_group_name="YourResourceGroupName", job_name="TestJobName1", cancellation_reason={"reason": "CancelTest"}, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCancelPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCancelPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py index 20cb83a9f5d9..333246279358 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create.py @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreate.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreate.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py index ddd499355079..a2979c351ebd 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_device_password.py @@ -72,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateDevicePassword.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateDevicePassword.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py index 43586c612591..c0ba58c63de0 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_double_encryption.py @@ -71,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateDoubleEncryption.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateDoubleEncryption.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py index 92987af5a6e4..95f6c1ce1541 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_export.py @@ -80,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateExport.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateExport.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py index 6e4301c4c4bb..448979de3be8 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_create_with_user_assigned_identity.py @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsCreateWithUserAssignedIdentity.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsCreateWithUserAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py index 6997b47fc00a..2af60ffddf8d 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.begin_delete( + client.jobs.begin_delete( resource_group_name="YourResourceGroupName", job_name="TestJobName1", ).result() - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsDelete.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsDelete.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py index 7ed67a69e020..d91cbf2b3d1e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGet.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGet.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py index dac4fa5bba6e..27acbe1ea3aa 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_cmk.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCmk.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetCmk.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py index 5b6ce0ce8e76..6fb24c0ac250 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_copy_stuck.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetCopyStuck.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetCopyStuck.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py index 0ba9e91d7282..a26f8534c559 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_export.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetExport.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetExport.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py index d956ffd5ba43..af6cfd74663a 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_get_waiting_for_action.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsGetWaitingForAction.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsGetWaitingForAction.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py index 6383e85a5241..6c1faafb5891 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsList.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsList.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py index 6a1bccb019af..d01a65fc2d9e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsListByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py index e6b3f7b96590..253d60f8fa4e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_list_credentials.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsListCredentials.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsListCredentials.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py index 28decddc681b..62503396f824 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatch.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatch.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py index 4f3bdc733e4e..06fed0d9582e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_cmk.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatchCmk.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatchCmk.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py index 541841f60102..2749a2413a75 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/jobs_patch_system_assigned_to_user_assigned.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/JobsPatchSystemAssignedToUserAssigned.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/JobsPatchSystemAssignedToUserAssigned.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py b/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py index 47c2c0c4b5d6..3716d0e6d49f 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/mark_devices_shipped.py @@ -29,16 +29,15 @@ def main(): subscription_id="YourSubscriptionId", ) - response = client.jobs.mark_devices_shipped( + client.jobs.mark_devices_shipped( job_name="TestJobName1", resource_group_name="YourResourceGroupName", mark_devices_shipped_request={ "deliverToDcPackageDetails": {"carrierName": "testCarrier", "trackingId": "000000"} }, ) - print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/MarkDevicesShipped.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/MarkDevicesShipped.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py b/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py index 9ba275ad01b6..c459996d7199 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/operations_get.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/OperationsGet.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/OperationsGet.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py index 487f53271c87..0cd96ecc9e9e 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/RegionConfiguration.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/RegionConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py index 0063055d826d..a3519e926323 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/region_configuration_by_resource_group.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/RegionConfigurationByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/RegionConfigurationByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py index 8d10ddf0e5c3..f0b197cf4ea1 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_address_post.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateAddressPost.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateAddressPost.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py index ec4bfbf97a5f..3422be65a32b 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs.py @@ -82,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateInputs.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateInputs.json if __name__ == "__main__": main() diff --git a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py index 4b6613759a8b..8d2580c0d664 100644 --- a/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py +++ b/sdk/databox/azure-mgmt-databox/generated_samples/validate_inputs_by_resource_group.py @@ -83,6 +83,6 @@ def main(): print(response) -# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2022-12-01/examples/ValidateInputsByResourceGroup.json +# x-ms-original-file: specification/databox/resource-manager/Microsoft.DataBox/stable/2023-03-01/examples/ValidateInputsByResourceGroup.json if __name__ == "__main__": main()