diff --git a/sdk/batch/azure-mgmt-batch/_meta.json b/sdk/batch/azure-mgmt-batch/_meta.json index 51c29ad14b42..8fc9e977b8e6 100644 --- a/sdk/batch/azure-mgmt-batch/_meta.json +++ b/sdk/batch/azure-mgmt-batch/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "d81e31601e4bcc061ac6436de40d97b7db5e4dd3", + "commit": "a1b0350f6b00b5f728e96e57d17a4f48a9c3bfcb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/batch/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/batch/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/batch/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py index 78a2c7275e61..21eada7ba672 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['BatchManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py index bda0002c0212..8a21ad06f59c 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import BatchManagementClientConfiguration +from .operations import ApplicationOperations, ApplicationPackageOperations, BatchAccountOperations, CertificateOperations, LocationOperations, Operations, PoolOperations, PrivateEndpointConnectionOperations, PrivateLinkResourceOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import BatchManagementClientConfiguration -from .operations import BatchAccountOperations -from .operations import ApplicationPackageOperations -from .operations import ApplicationOperations -from .operations import LocationOperations -from .operations import Operations -from .operations import CertificateOperations -from .operations import PrivateLinkResourceOperations -from .operations import PrivateEndpointConnectionOperations -from .operations import PoolOperations -from . import models - -class BatchManagementClient(object): +class BatchManagementClient: """Batch Client. :ivar batch_account: BatchAccountOperations operations @@ -49,71 +39,71 @@ class BatchManagementClient(object): :ivar private_link_resource: PrivateLinkResourceOperations operations :vartype private_link_resource: azure.mgmt.batch.operations.PrivateLinkResourceOperations :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations - :vartype private_endpoint_connection: azure.mgmt.batch.operations.PrivateEndpointConnectionOperations + :vartype private_endpoint_connection: + azure.mgmt.batch.operations.PrivateEndpointConnectionOperations :ivar pool: PoolOperations operations :vartype pool: azure.mgmt.batch.operations.PoolOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: 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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = BatchManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = BatchManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = 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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.batch_account = BatchAccountOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_package = ApplicationPackageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application = ApplicationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.certificate = CertificateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resource = PrivateLinkResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connection = PrivateEndpointConnectionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.pool = PoolOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.batch_account = BatchAccountOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_package = ApplicationPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.application = ApplicationOperations(self._client, self._config, self._serialize, self._deserialize) + self.location = LocationOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resource = PrivateLinkResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.pool = PoolOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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/python/protocol/quickstart + + :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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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): # type: () -> None diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py index f78eba59a665..ecb96ee47c70 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class BatchManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(BatchManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(BatchManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json index 11745c6c2ee4..09c04c4d7e68 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], + "chosen_version": "2022-01-01", + "total_api_version_list": ["2022-01-01"], "client": { "name": "BatchManagementClient", "filename": "_batch_management_client", "description": "Batch Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "batch_account": "BatchAccountOperations", diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_patch.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +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: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_version.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_version.py index 645cd18c85d4..c23f64adb662 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_version.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "16.0.0" +VERSION = "14.0.0b1" diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py index 5a720eaafff3..5220f1b3d0f1 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py @@ -8,3 +8,8 @@ from ._batch_management_client import BatchManagementClient __all__ = ['BatchManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py index b38dc761a779..3b1570f8a34f 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import BatchManagementClientConfiguration +from .operations import ApplicationOperations, ApplicationPackageOperations, BatchAccountOperations, CertificateOperations, LocationOperations, Operations, PoolOperations, PrivateEndpointConnectionOperations, PrivateLinkResourceOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import BatchManagementClientConfiguration -from .operations import BatchAccountOperations -from .operations import ApplicationPackageOperations -from .operations import ApplicationOperations -from .operations import LocationOperations -from .operations import Operations -from .operations import CertificateOperations -from .operations import PrivateLinkResourceOperations -from .operations import PrivateEndpointConnectionOperations -from .operations import PoolOperations -from .. import models - - -class BatchManagementClient(object): +class BatchManagementClient: """Batch Client. :ivar batch_account: BatchAccountOperations operations @@ -47,69 +39,71 @@ class BatchManagementClient(object): :ivar private_link_resource: PrivateLinkResourceOperations operations :vartype private_link_resource: azure.mgmt.batch.aio.operations.PrivateLinkResourceOperations :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations - :vartype private_endpoint_connection: azure.mgmt.batch.aio.operations.PrivateEndpointConnectionOperations + :vartype private_endpoint_connection: + azure.mgmt.batch.aio.operations.PrivateEndpointConnectionOperations :ivar pool: PoolOperations operations :vartype pool: azure.mgmt.batch.aio.operations.PoolOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: 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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = BatchManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = BatchManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = 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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.batch_account = BatchAccountOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_package = ApplicationPackageOperations(self._client, self._config, self._serialize, self._deserialize) + self.application = ApplicationOperations(self._client, self._config, self._serialize, self._deserialize) + self.location = LocationOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.certificate = CertificateOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resource = PrivateLinkResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.pool = PoolOperations(self._client, self._config, self._serialize, self._deserialize) + - self.batch_account = BatchAccountOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_package = ApplicationPackageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application = ApplicationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.certificate = CertificateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resource = PrivateLinkResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connection = PrivateEndpointConnectionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.pool = PoolOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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/python/protocol/quickstart + + :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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_configuration.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_configuration.py index e658ffb1231e..6f34152872c5 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_configuration.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(BatchManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(BatchManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_patch.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_operations.py index eb8d1af5fd5b..a4187f4ad699 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -69,36 +75,26 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + _json = self._serialize.body(parameters, 'Application') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +108,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -139,28 +138,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -173,6 +162,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -198,28 +189,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -233,8 +214,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -263,33 +247,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Application') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,8 +277,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -321,8 +298,10 @@ def list( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListApplicationsResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationsResult] + :return: An iterator like instance of either ListApplicationsResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationsResult"] @@ -330,38 +309,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListApplicationsResult', pipeline_response) + deserialized = self._deserialize("ListApplicationsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -379,6 +355,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_package_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_package_operations.py index 0e28c2776ba8..25ea2e2a2920 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_package_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_application_package_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_package_operations import build_activate_request, build_create_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def activate( self, resource_group_name: str, @@ -74,34 +80,24 @@ async def activate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.activate.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') + + request = build_activate_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +111,11 @@ async def activate( return cls(pipeline_response, deserialized, {}) return deserialized + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -151,37 +150,27 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ApplicationPackage') + _json = self._serialize.body(parameters, 'ApplicationPackage') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,8 +184,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -225,29 +217,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,6 +242,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,29 +272,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -324,8 +298,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -345,8 +322,10 @@ def list( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListApplicationPackagesResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationPackagesResult] + :return: An iterator like instance of either ListApplicationPackagesResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationPackagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationPackagesResult"] @@ -354,39 +333,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListApplicationPackagesResult', pipeline_response) + deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -404,6 +381,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_batch_account_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_batch_account_operations.py index a534e9f56603..c8c47ccb4d74 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_batch_account_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_batch_account_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.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._batch_account_operations import build_create_request_initial, build_delete_request_initial, build_get_detector_request, build_get_keys_request, build_get_request, build_list_by_resource_group_request, build_list_detectors_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_regenerate_key_request, build_synchronize_auto_storage_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BatchAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -88,21 +83,25 @@ async def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BatchAccount', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -125,15 +124,19 @@ async def begin_create( :type parameters: ~azure.mgmt.batch.models.BatchAccountCreateParameters :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. + :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 BatchAccount or the result of cls(response) + :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 BatchAccount or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.BatchAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +148,21 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BatchAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -177,8 +174,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -204,32 +203,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BatchAccountUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,8 +232,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -256,27 +247,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -288,12 +269,15 @@ async def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -308,15 +292,17 @@ async def begin_delete( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -330,21 +316,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -356,8 +335,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -380,27 +361,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -414,8 +385,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, **kwargs: Any @@ -423,8 +397,10 @@ def list( """Gets information about the Batch accounts associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BatchAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] + :return: An iterator like instance of either BatchAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] @@ -432,34 +408,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('BatchAccountListResult', pipeline_response) + deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -477,11 +448,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -492,8 +465,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group that contains the Batch account. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BatchAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] + :return: An iterator like instance of either BatchAccountListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] @@ -501,35 +476,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('BatchAccountListResult', pipeline_response) + deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -547,11 +518,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + @distributed_trace_async async def synchronize_auto_storage_keys( self, resource_group_name: str, @@ -575,27 +548,17 @@ async def synchronize_auto_storage_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.synchronize_auto_storage_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_synchronize_auto_storage_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.synchronize_auto_storage_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -608,6 +571,8 @@ async def synchronize_auto_storage_keys( synchronize_auto_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -638,32 +603,22 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,8 +632,11 @@ async def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'} # type: ignore + + @distributed_trace_async async def get_keys( self, resource_group_name: str, @@ -706,27 +664,17 @@ async def get_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -740,8 +688,139 @@ async def get_keys( return cls(pipeline_response, deserialized, {}) return deserialized + get_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace + def list_detectors( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DetectorListResult"]: + """Gets information about the detectors available for a given Batch account. + + :param resource_group_name: The name of the resource group that contains the Batch account. + :type resource_group_name: str + :param account_name: The name of the Batch account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.DetectorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_detectors_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + template_url=self.list_detectors.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_detectors_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + template_url=next_link, + ) + 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("DetectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors'} # type: ignore + + @distributed_trace_async + async def get_detector( + self, + resource_group_name: str, + account_name: str, + detector_id: str, + **kwargs: Any + ) -> "_models.DetectorResponse": + """Gets information about the given detector for a given Batch account. + + :param resource_group_name: The name of the resource group that contains the Batch account. + :type resource_group_name: str + :param account_name: The name of the Batch account. + :type account_name: str + :param detector_id: The name of the detector. + :type detector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.batch.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_detector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + detector_id=detector_id, + template_url=self.get_detector.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}'} # type: ignore + + + @distributed_trace def list_outbound_network_dependencies_endpoints( self, resource_group_name: str, @@ -760,8 +839,10 @@ def list_outbound_network_dependencies_endpoints( :param account_name: The name of the Batch account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] @@ -769,36 +850,33 @@ def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('OutboundEnvironmentEndpointCollection', pipeline_response) + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -816,6 +894,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_certificate_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_certificate_operations.py index 438d2a5c3141..7e6e6957bd58 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_certificate_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_certificate_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.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._certificate_operations import build_cancel_deletion_request, build_create_request, build_delete_request_initial, build_get_request, build_list_by_batch_account_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, resource_group_name: str, @@ -68,8 +74,10 @@ def list_by_batch_account( "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListCertificatesResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListCertificatesResult] + :return: An iterator like instance of either ListCertificatesResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListCertificatesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListCertificatesResult"] @@ -77,42 +85,39 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=next_link, + ) + 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('ListCertificatesResult', pipeline_response) + deserialized = self._deserialize("ListCertificatesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,11 +135,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -174,37 +181,25 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -214,14 +209,18 @@ async def create( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -256,35 +255,24 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -294,14 +282,17 @@ async def update( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -314,28 +305,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -347,12 +328,15 @@ async def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -372,15 +356,17 @@ async def begin_delete( :type certificate_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,22 +381,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +400,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -451,28 +431,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -482,14 +452,18 @@ async def get( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def cancel_deletion( self, resource_group_name: str, @@ -524,28 +498,18 @@ async def cancel_deletion( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.cancel_deletion.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_deletion_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self.cancel_deletion.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -555,10 +519,13 @@ async def cancel_deletion( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + cancel_deletion.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_location_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_location_operations.py index 455a946716e2..547e0b92a3a5 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_location_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_location_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._location_operations import build_check_name_availability_request, build_get_quotas_request, build_list_supported_cloud_service_skus_request, build_list_supported_virtual_machine_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_quotas( self, location_name: str, @@ -60,26 +66,16 @@ async def get_quotas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_quotas.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_quotas_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + template_url=self.get_quotas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -93,8 +89,11 @@ async def get_quotas( return cls(pipeline_response, deserialized, {}) return deserialized + get_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas'} # type: ignore + + @distributed_trace def list_supported_virtual_machine_skus( self, location_name: str, @@ -120,39 +119,35 @@ def list_supported_virtual_machine_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_supported_virtual_machine_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_virtual_machine_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=self.list_supported_virtual_machine_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_virtual_machine_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=next_link, + ) + 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('SupportedSkusResult', pipeline_response) + deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -170,11 +165,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_supported_virtual_machine_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus'} # type: ignore + @distributed_trace def list_supported_cloud_service_skus( self, location_name: str, @@ -200,39 +197,35 @@ def list_supported_cloud_service_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_supported_cloud_service_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_cloud_service_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=self.list_supported_cloud_service_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_cloud_service_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=next_link, + ) + 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('SupportedSkusResult', pipeline_response) + deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -250,11 +243,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_supported_cloud_service_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus'} # type: ignore + @distributed_trace_async async def check_name_availability( self, location_name: str, @@ -277,31 +272,21 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,4 +300,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_operations.py index ae1f3b4b5c17..aac41489d214 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + 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('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +101,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_pool_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_pool_operations.py index 0c84bc54c45d..8f9bf1b6bc47 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_pool_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_pool_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.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._pool_operations import build_create_request, build_delete_request_initial, build_disable_auto_scale_request, build_get_request, build_list_by_batch_account_request, build_stop_resize_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, resource_group_name: str, @@ -88,42 +94,39 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=next_link, + ) + 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('ListPoolsResult', pipeline_response) + deserialized = self._deserialize("ListPoolsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -141,11 +144,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools'} # type: ignore + @distributed_trace_async async def create( self, resource_group_name: str, @@ -183,37 +188,25 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Pool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Pool') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -223,14 +216,18 @@ async def create( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -264,35 +261,24 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Pool') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Pool') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,14 +288,17 @@ async def update( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -322,28 +311,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -355,12 +334,15 @@ async def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -378,15 +360,17 @@ async def begin_delete( :type pool_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -401,22 +385,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -428,8 +404,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -455,28 +433,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -486,14 +454,18 @@ async def get( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace_async async def disable_auto_scale( self, resource_group_name: str, @@ -519,28 +491,18 @@ async def disable_auto_scale( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.disable_auto_scale.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_auto_scale_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.disable_auto_scale.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,14 +512,18 @@ async def disable_auto_scale( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + disable_auto_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale'} # type: ignore + + @distributed_trace_async async def stop_resize( self, resource_group_name: str, @@ -590,28 +556,18 @@ async def stop_resize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.stop_resize.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_resize_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.stop_resize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -621,10 +577,13 @@ async def stop_resize( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + stop_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_endpoint_connection_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_endpoint_connection_operations.py index e8ab3477122f..b5e1d89f13ad 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_endpoint_connection_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.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._private_endpoint_connection_operations import build_get_request, build_list_by_batch_account_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list_by_batch_account( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListPrivateEndpointConnectionsResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] + :return: An iterator like instance of either ListPrivateEndpointConnectionsResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateEndpointConnectionsResult"] @@ -68,38 +76,35 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListPrivateEndpointConnectionsResult', pipeline_response) + deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,28 +155,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,8 +180,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -199,35 +198,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -235,21 +223,25 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -276,15 +268,19 @@ async def begin_update( :type if_match: 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. + :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 PrivateEndpointConnection or the result of cls(response) + :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 PrivateEndpointConnection or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,28 +294,21 @@ async def begin_update( private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,4 +320,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_link_resource_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_link_resource_operations.py index 3a5af5e4ecbd..c89d5526b011 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_link_resource_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/_private_link_resource_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resource_operations import build_get_request, build_list_by_batch_account_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_batch_account( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListPrivateLinkResourcesResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateLinkResourcesResult] + :return: An iterator like instance of either ListPrivateLinkResourcesResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateLinkResourcesResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateLinkResourcesResult"] @@ -66,38 +74,35 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListPrivateLinkResourcesResult', pipeline_response) + deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,11 +120,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,4 +178,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/__init__.py index 48505f94f317..0de86b5a4b15 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/__init__.py @@ -6,198 +6,104 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActivateApplicationPackageParameters - from ._models_py3 import Application - from ._models_py3 import ApplicationPackage - from ._models_py3 import ApplicationPackageReference - from ._models_py3 import AutoScaleRun - from ._models_py3 import AutoScaleRunError - from ._models_py3 import AutoScaleSettings - from ._models_py3 import AutoStorageBaseProperties - from ._models_py3 import AutoStorageProperties - from ._models_py3 import AutoUserSpecification - from ._models_py3 import AzureBlobFileSystemConfiguration - from ._models_py3 import AzureFileShareConfiguration - from ._models_py3 import BatchAccount - from ._models_py3 import BatchAccountCreateParameters - from ._models_py3 import BatchAccountIdentity - from ._models_py3 import BatchAccountKeys - from ._models_py3 import BatchAccountListResult - from ._models_py3 import BatchAccountRegenerateKeyParameters - from ._models_py3 import BatchAccountUpdateParameters - from ._models_py3 import BatchLocationQuota - from ._models_py3 import BatchPoolIdentity - from ._models_py3 import CIFSMountConfiguration - from ._models_py3 import Certificate - from ._models_py3 import CertificateBaseProperties - from ._models_py3 import CertificateCreateOrUpdateParameters - from ._models_py3 import CertificateCreateOrUpdateProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateReference - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import CloudServiceConfiguration - from ._models_py3 import ComputeNodeIdentityReference - from ._models_py3 import ContainerConfiguration - from ._models_py3 import ContainerRegistry - from ._models_py3 import DataDisk - from ._models_py3 import DeleteCertificateError - from ._models_py3 import DeploymentConfiguration - from ._models_py3 import DiffDiskSettings - from ._models_py3 import DiskEncryptionConfiguration - from ._models_py3 import EncryptionProperties - from ._models_py3 import EndpointDependency - from ._models_py3 import EndpointDetail - from ._models_py3 import EnvironmentSetting - from ._models_py3 import FixedScaleSettings - from ._models_py3 import ImageReference - from ._models_py3 import InboundNatPool - from ._models_py3 import KeyVaultProperties - from ._models_py3 import KeyVaultReference - from ._models_py3 import LinuxUserConfiguration - from ._models_py3 import ListApplicationPackagesResult - from ._models_py3 import ListApplicationsResult - from ._models_py3 import ListCertificatesResult - from ._models_py3 import ListPoolsResult - from ._models_py3 import ListPrivateEndpointConnectionsResult - from ._models_py3 import ListPrivateLinkResourcesResult - from ._models_py3 import MetadataItem - from ._models_py3 import MountConfiguration - from ._models_py3 import NFSMountConfiguration - from ._models_py3 import NetworkConfiguration - from ._models_py3 import NetworkSecurityGroupRule - from ._models_py3 import NodePlacementConfiguration - from ._models_py3 import OSDisk - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OutboundEnvironmentEndpoint - from ._models_py3 import OutboundEnvironmentEndpointCollection - from ._models_py3 import Pool - from ._models_py3 import PoolEndpointConfiguration - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import PublicIPAddressConfiguration - from ._models_py3 import ResizeError - from ._models_py3 import ResizeOperationStatus - from ._models_py3 import Resource - from ._models_py3 import ResourceFile - from ._models_py3 import ScaleSettings - from ._models_py3 import SkuCapability - from ._models_py3 import StartTask - from ._models_py3 import SupportedSku - from ._models_py3 import SupportedSkusResult - from ._models_py3 import TaskContainerSettings - from ._models_py3 import TaskSchedulingPolicy - from ._models_py3 import UserAccount - from ._models_py3 import UserAssignedIdentities - from ._models_py3 import UserIdentity - from ._models_py3 import VMExtension - from ._models_py3 import VirtualMachineConfiguration - from ._models_py3 import VirtualMachineFamilyCoreQuota - from ._models_py3 import WindowsConfiguration - from ._models_py3 import WindowsUserConfiguration -except (SyntaxError, ImportError): - from ._models import ActivateApplicationPackageParameters # type: ignore - from ._models import Application # type: ignore - from ._models import ApplicationPackage # type: ignore - from ._models import ApplicationPackageReference # type: ignore - from ._models import AutoScaleRun # type: ignore - from ._models import AutoScaleRunError # type: ignore - from ._models import AutoScaleSettings # type: ignore - from ._models import AutoStorageBaseProperties # type: ignore - from ._models import AutoStorageProperties # type: ignore - from ._models import AutoUserSpecification # type: ignore - from ._models import AzureBlobFileSystemConfiguration # type: ignore - from ._models import AzureFileShareConfiguration # type: ignore - from ._models import BatchAccount # type: ignore - from ._models import BatchAccountCreateParameters # type: ignore - from ._models import BatchAccountIdentity # type: ignore - from ._models import BatchAccountKeys # type: ignore - from ._models import BatchAccountListResult # type: ignore - from ._models import BatchAccountRegenerateKeyParameters # type: ignore - from ._models import BatchAccountUpdateParameters # type: ignore - from ._models import BatchLocationQuota # type: ignore - from ._models import BatchPoolIdentity # type: ignore - from ._models import CIFSMountConfiguration # type: ignore - from ._models import Certificate # type: ignore - from ._models import CertificateBaseProperties # type: ignore - from ._models import CertificateCreateOrUpdateParameters # type: ignore - from ._models import CertificateCreateOrUpdateProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateReference # type: ignore - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import CloudServiceConfiguration # type: ignore - from ._models import ComputeNodeIdentityReference # type: ignore - from ._models import ContainerConfiguration # type: ignore - from ._models import ContainerRegistry # type: ignore - from ._models import DataDisk # type: ignore - from ._models import DeleteCertificateError # type: ignore - from ._models import DeploymentConfiguration # type: ignore - from ._models import DiffDiskSettings # type: ignore - from ._models import DiskEncryptionConfiguration # type: ignore - from ._models import EncryptionProperties # type: ignore - from ._models import EndpointDependency # type: ignore - from ._models import EndpointDetail # type: ignore - from ._models import EnvironmentSetting # type: ignore - from ._models import FixedScaleSettings # type: ignore - from ._models import ImageReference # type: ignore - from ._models import InboundNatPool # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import KeyVaultReference # type: ignore - from ._models import LinuxUserConfiguration # type: ignore - from ._models import ListApplicationPackagesResult # type: ignore - from ._models import ListApplicationsResult # type: ignore - from ._models import ListCertificatesResult # type: ignore - from ._models import ListPoolsResult # type: ignore - from ._models import ListPrivateEndpointConnectionsResult # type: ignore - from ._models import ListPrivateLinkResourcesResult # type: ignore - from ._models import MetadataItem # type: ignore - from ._models import MountConfiguration # type: ignore - from ._models import NFSMountConfiguration # type: ignore - from ._models import NetworkConfiguration # type: ignore - from ._models import NetworkSecurityGroupRule # type: ignore - from ._models import NodePlacementConfiguration # type: ignore - from ._models import OSDisk # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OutboundEnvironmentEndpoint # type: ignore - from ._models import OutboundEnvironmentEndpointCollection # type: ignore - from ._models import Pool # type: ignore - from ._models import PoolEndpointConfiguration # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import PublicIPAddressConfiguration # type: ignore - from ._models import ResizeError # type: ignore - from ._models import ResizeOperationStatus # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceFile # type: ignore - from ._models import ScaleSettings # type: ignore - from ._models import SkuCapability # type: ignore - from ._models import StartTask # type: ignore - from ._models import SupportedSku # type: ignore - from ._models import SupportedSkusResult # type: ignore - from ._models import TaskContainerSettings # type: ignore - from ._models import TaskSchedulingPolicy # type: ignore - from ._models import UserAccount # type: ignore - from ._models import UserAssignedIdentities # type: ignore - from ._models import UserIdentity # type: ignore - from ._models import VMExtension # type: ignore - from ._models import VirtualMachineConfiguration # type: ignore - from ._models import VirtualMachineFamilyCoreQuota # type: ignore - from ._models import WindowsConfiguration # type: ignore - from ._models import WindowsUserConfiguration # type: ignore +from ._models_py3 import ActivateApplicationPackageParameters +from ._models_py3 import Application +from ._models_py3 import ApplicationPackage +from ._models_py3 import ApplicationPackageReference +from ._models_py3 import AutoScaleRun +from ._models_py3 import AutoScaleRunError +from ._models_py3 import AutoScaleSettings +from ._models_py3 import AutoStorageBaseProperties +from ._models_py3 import AutoStorageProperties +from ._models_py3 import AutoUserSpecification +from ._models_py3 import AzureBlobFileSystemConfiguration +from ._models_py3 import AzureFileShareConfiguration +from ._models_py3 import BatchAccount +from ._models_py3 import BatchAccountCreateParameters +from ._models_py3 import BatchAccountIdentity +from ._models_py3 import BatchAccountKeys +from ._models_py3 import BatchAccountListResult +from ._models_py3 import BatchAccountRegenerateKeyParameters +from ._models_py3 import BatchAccountUpdateParameters +from ._models_py3 import BatchLocationQuota +from ._models_py3 import BatchPoolIdentity +from ._models_py3 import CIFSMountConfiguration +from ._models_py3 import Certificate +from ._models_py3 import CertificateBaseProperties +from ._models_py3 import CertificateCreateOrUpdateParameters +from ._models_py3 import CertificateCreateOrUpdateProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateReference +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import CloudServiceConfiguration +from ._models_py3 import ComputeNodeIdentityReference +from ._models_py3 import ContainerConfiguration +from ._models_py3 import ContainerRegistry +from ._models_py3 import DataDisk +from ._models_py3 import DeleteCertificateError +from ._models_py3 import DeploymentConfiguration +from ._models_py3 import DetectorListResult +from ._models_py3 import DetectorResponse +from ._models_py3 import DiffDiskSettings +from ._models_py3 import DiskEncryptionConfiguration +from ._models_py3 import EncryptionProperties +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import EnvironmentSetting +from ._models_py3 import FixedScaleSettings +from ._models_py3 import ImageReference +from ._models_py3 import InboundNatPool +from ._models_py3 import KeyVaultProperties +from ._models_py3 import KeyVaultReference +from ._models_py3 import LinuxUserConfiguration +from ._models_py3 import ListApplicationPackagesResult +from ._models_py3 import ListApplicationsResult +from ._models_py3 import ListCertificatesResult +from ._models_py3 import ListPoolsResult +from ._models_py3 import ListPrivateEndpointConnectionsResult +from ._models_py3 import ListPrivateLinkResourcesResult +from ._models_py3 import MetadataItem +from ._models_py3 import MountConfiguration +from ._models_py3 import NFSMountConfiguration +from ._models_py3 import NetworkConfiguration +from ._models_py3 import NetworkSecurityGroupRule +from ._models_py3 import NodePlacementConfiguration +from ._models_py3 import OSDisk +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection +from ._models_py3 import Pool +from ._models_py3 import PoolEndpointConfiguration +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import PublicIPAddressConfiguration +from ._models_py3 import ResizeError +from ._models_py3 import ResizeOperationStatus +from ._models_py3 import Resource +from ._models_py3 import ResourceFile +from ._models_py3 import ScaleSettings +from ._models_py3 import SkuCapability +from ._models_py3 import StartTask +from ._models_py3 import SupportedSku +from ._models_py3 import SupportedSkusResult +from ._models_py3 import TaskContainerSettings +from ._models_py3 import TaskSchedulingPolicy +from ._models_py3 import UserAccount +from ._models_py3 import UserAssignedIdentities +from ._models_py3 import UserIdentity +from ._models_py3 import VMExtension +from ._models_py3 import VirtualMachineConfiguration +from ._models_py3 import VirtualMachineFamilyCoreQuota +from ._models_py3 import WindowsConfiguration +from ._models_py3 import WindowsUserConfiguration + from ._batch_management_client_enums import ( AccountKeyType, @@ -214,6 +120,7 @@ ComputeNodeFillType, ContainerWorkingDirectory, DiskEncryptionTarget, + DynamicVNetAssignmentScope, ElevationLevel, IPAddressProvisioningType, InboundEndpointProtocol, @@ -274,6 +181,8 @@ 'DataDisk', 'DeleteCertificateError', 'DeploymentConfiguration', + 'DetectorListResult', + 'DetectorResponse', 'DiffDiskSettings', 'DiskEncryptionConfiguration', 'EncryptionProperties', @@ -345,6 +254,7 @@ 'ComputeNodeFillType', 'ContainerWorkingDirectory', 'DiskEncryptionTarget', + 'DynamicVNetAssignmentScope', 'ElevationLevel', 'IPAddressProvisioningType', 'InboundEndpointProtocol', diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_batch_management_client_enums.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_batch_management_client_enums.py index 2e99f0365b22..94f9dba7d66f 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_batch_management_client_enums.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_batch_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccountKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of account key to regenerate. """ @@ -35,7 +20,7 @@ class AccountKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The secondary account key. SECONDARY = "Secondary" -class AllocationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AllocationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether the pool is resizing. """ @@ -49,7 +34,7 @@ class AllocationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: request has not yet been completed. STOPPING = "Stopping" -class AuthenticationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthenticationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication mode for the Batch account. """ @@ -60,7 +45,7 @@ class AuthenticationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The authentication mode using task authentication tokens. TASK_AUTHENTICATION_TOKEN = "TaskAuthenticationToken" -class AutoStorageAuthenticationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AutoStorageAuthenticationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication mode which the Batch service will use to manage the auto-storage account. """ @@ -70,7 +55,7 @@ class AutoStorageAuthenticationMode(with_metaclass(_CaseInsensitiveEnumMeta, str #: assigned to the Batch account. BATCH_ACCOUNT_MANAGED_IDENTITY = "BatchAccountManagedIdentity" -class AutoUserScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AutoUserScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool @@ -83,7 +68,7 @@ class AutoUserScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: a pool. POOL = "Pool" -class CachingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CachingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of caching to enable for the disk. """ @@ -94,7 +79,7 @@ class CachingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The caching mode for the disk is read and write. READ_WRITE = "ReadWrite" -class CertificateFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. """ @@ -103,7 +88,7 @@ class CertificateFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The certificate is a base64-encoded X.509 certificate. CER = "Cer" -class CertificateProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The certificate is available for use in pools. SUCCEEDED = "Succeeded" @@ -118,7 +103,7 @@ class CertificateProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, #: the delete. FAILED = "Failed" -class CertificateStoreLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateStoreLocation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the @@ -133,7 +118,7 @@ class CertificateStoreLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: Certificates should be installed to the LocalMachine certificate store. LOCAL_MACHINE = "LocalMachine" -class CertificateVisibility(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateVisibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The certificate should be visible to the user account under which the start task is run. Note #: that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be @@ -145,7 +130,7 @@ class CertificateVisibility(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: node. REMOTE_USER = "RemoteUser" -class ComputeNodeDeallocationOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComputeNodeDeallocationOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines what to do with a node and its running task(s) after it has been selected for deallocation. """ @@ -164,7 +149,7 @@ class ComputeNodeDeallocationOption(with_metaclass(_CaseInsensitiveEnumMeta, str #: expired. RETAINED_DATA = "RetainedData" -class ComputeNodeFillType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComputeNodeFillType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """How tasks should be distributed across compute nodes. """ @@ -174,7 +159,7 @@ class ComputeNodeFillType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: any tasks are assigned to the next node in the pool. PACK = "Pack" -class ContainerWorkingDirectory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerWorkingDirectory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A flag to indicate where the container task working directory is. The default is 'taskWorkingDirectory'. """ @@ -186,7 +171,7 @@ class ContainerWorkingDirectory(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: the resource files downloaded by Batch. CONTAINER_IMAGE_DEFAULT = "ContainerImageDefault" -class DiskEncryptionTarget(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskEncryptionTarget(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If omitted, no disks on the compute nodes in the pool will be encrypted. """ @@ -196,7 +181,17 @@ class DiskEncryptionTarget(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: partitions (such as those on mounted data disks) when encryption occurs at boot time. TEMPORARY_DISK = "TemporaryDisk" -class ElevationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DynamicVNetAssignmentScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The scope of dynamic vnet assignment. + """ + + #: No dynamic VNet assignment is enabled. + NONE = "none" + #: Dynamic VNet assignment is done per-job. Don't use this option unless your batch account has + #: been approved to use this feature. + JOB = "job" + +class ElevationLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The elevation level of the user. """ @@ -205,7 +200,7 @@ class ElevationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The user is a user with elevated access and operates with full Administrator permissions. ADMIN = "Admin" -class InboundEndpointProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InboundEndpointProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol of the endpoint. """ @@ -214,7 +209,7 @@ class InboundEndpointProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Use UDP for the endpoint. UDP = "UDP" -class InterNodeCommunicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InterNodeCommunicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. @@ -225,7 +220,7 @@ class InterNodeCommunicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Disable network communication between virtual machines. DISABLED = "Disabled" -class IPAddressProvisioningType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IPAddressProvisioningType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning type for Public IP Addresses for the Batch Pool. """ @@ -237,7 +232,7 @@ class IPAddressProvisioningType(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: No public IP Address will be created for the Compute Nodes in the Pool. NO_PUBLIC_IP_ADDRESSES = "NoPublicIPAddresses" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the key source. """ @@ -248,7 +243,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Identifier must also be supplied under the keyVaultProperties. MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" -class LoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LoginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. """ @@ -261,7 +256,7 @@ class LoginMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: task, then this option is recommended. INTERACTIVE = "Interactive" -class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -271,7 +266,7 @@ class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) #: The requested name is already in use. ALREADY_EXISTS = "AlreadyExists" -class NetworkSecurityGroupRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkSecurityGroupRuleAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The action that should be taken for a specified IP address, subnet range or tag. """ @@ -280,7 +275,7 @@ class NetworkSecurityGroupRuleAccess(with_metaclass(_CaseInsensitiveEnumMeta, st #: Deny access. DENY = "Deny" -class NodePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodePlacementPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default value is regional. """ @@ -289,7 +284,7 @@ class NodePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Nodes in the pool will be spread across different zones with best effort balancing. ZONAL = "Zonal" -class PackageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PackageState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the application package. """ @@ -298,7 +293,7 @@ class PackageState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The application package is ready for use. ACTIVE = "Active" -class PoolAllocationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PoolAllocationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The allocation mode for creating pools in the Batch account. """ @@ -307,7 +302,7 @@ class PoolAllocationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Pools will be allocated in a subscription owned by the user. USER_SUBSCRIPTION = "UserSubscription" -class PoolIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PoolIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the Batch Pool. """ @@ -317,7 +312,7 @@ class PoolIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: existing identities. NONE = "None" -class PoolProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PoolProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the pool. """ @@ -327,7 +322,7 @@ class PoolProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: completed. DELETING = "Deleting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the private endpoint connection. """ @@ -340,7 +335,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive #: operation. FAILED = "Failed" -class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Batch private endpoint connection """ @@ -353,7 +348,7 @@ class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta #: The private endpoint connection is disconnected and cannot be used to access Batch account. DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioned state of the resource """ @@ -370,7 +365,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The last operation for the account is cancelled. CANCELLED = "Cancelled" -class PublicNetworkAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network access type for operating on the resources in the Batch account. """ @@ -380,7 +375,7 @@ class PublicNetworkAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: private endpoint resource. DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the Batch account. """ @@ -392,7 +387,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: remove existing identities. NONE = "None" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The storage account type for use in creating data disks. """ diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models.py deleted file mode 100644 index 6c155a5bf818..000000000000 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models.py +++ /dev/null @@ -1,3756 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class ActivateApplicationPackageParameters(msrest.serialization.Model): - """Parameters for an activating an application package. - - All required parameters must be populated in order to send to Azure. - - :param format: Required. The format of the application package binary file. - :type format: str - """ - - _validation = { - 'format': {'required': True}, - } - - _attribute_map = { - 'format': {'key': 'format', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActivateApplicationPackageParameters, self).__init__(**kwargs) - self.format = kwargs['format'] - - -class ProxyResource(msrest.serialization.Model): - """A definition of an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = None - - -class Application(ProxyResource): - """Contains information about an application in a Batch account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :param display_name: The display name for the application. - :type display_name: str - :param allow_updates: A value indicating whether packages within the application may be - overwritten using the same version string. - :type allow_updates: bool - :param default_version: The package to use if a client requests the application but does not - specify a version. This property can only be set to the name of an existing package. - :type default_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'allow_updates': {'key': 'properties.allowUpdates', 'type': 'bool'}, - 'default_version': {'key': 'properties.defaultVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Application, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.allow_updates = kwargs.get('allow_updates', None) - self.default_version = kwargs.get('default_version', None) - - -class ApplicationPackage(ProxyResource): - """An application package which represents a particular version of an application. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :ivar state: The current state of the application package. Possible values include: "Pending", - "Active". - :vartype state: str or ~azure.mgmt.batch.models.PackageState - :ivar format: The format of the application package, if the package is active. - :vartype format: str - :ivar storage_url: The URL for the application package in Azure Storage. - :vartype storage_url: str - :ivar storage_url_expiry: The UTC time at which the Azure Storage URL will expire. - :vartype storage_url_expiry: ~datetime.datetime - :ivar last_activation_time: The time at which the package was last activated, if the package is - active. - :vartype last_activation_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - 'format': {'readonly': True}, - 'storage_url': {'readonly': True}, - 'storage_url_expiry': {'readonly': True}, - 'last_activation_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'format': {'key': 'properties.format', 'type': 'str'}, - 'storage_url': {'key': 'properties.storageUrl', 'type': 'str'}, - 'storage_url_expiry': {'key': 'properties.storageUrlExpiry', 'type': 'iso-8601'}, - 'last_activation_time': {'key': 'properties.lastActivationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationPackage, self).__init__(**kwargs) - self.state = None - self.format = None - self.storage_url = None - self.storage_url_expiry = None - self.last_activation_time = None - - -class ApplicationPackageReference(msrest.serialization.Model): - """Link to an application package inside the batch account. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The ID of the application package to install. This must be inside the same - batch account as the pool. This can either be a reference to a specific version or the default - version if one exists. - :type id: str - :param version: If this is omitted, and no default version is specified for this application, - the request fails with the error code InvalidApplicationPackageReferences. If you are calling - the REST API directly, the HTTP status code is 409. - :type version: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationPackageReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.version = kwargs.get('version', None) - - -class AutoScaleRun(msrest.serialization.Model): - """The results and errors from an execution of a pool autoscale formula. - - All required parameters must be populated in order to send to Azure. - - :param evaluation_time: Required. The time at which the autoscale formula was last evaluated. - :type evaluation_time: ~datetime.datetime - :param results: Each variable value is returned in the form $variable=value, and variables are - separated by semicolons. - :type results: str - :param error: An error that occurred when autoscaling a pool. - :type error: ~azure.mgmt.batch.models.AutoScaleRunError - """ - - _validation = { - 'evaluation_time': {'required': True}, - } - - _attribute_map = { - 'evaluation_time': {'key': 'evaluationTime', 'type': 'iso-8601'}, - 'results': {'key': 'results', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'AutoScaleRunError'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoScaleRun, self).__init__(**kwargs) - self.evaluation_time = kwargs['evaluation_time'] - self.results = kwargs.get('results', None) - self.error = kwargs.get('error', None) - - -class AutoScaleRunError(msrest.serialization.Model): - """An error that occurred when autoscaling a pool. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. An identifier for the error. Codes are invariant and are intended to be - consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param details: Additional details about the error. - :type details: list[~azure.mgmt.batch.models.AutoScaleRunError] - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[AutoScaleRunError]'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoScaleRunError, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.details = kwargs.get('details', None) - - -class AutoScaleSettings(msrest.serialization.Model): - """AutoScale settings for the pool. - - All required parameters must be populated in order to send to Azure. - - :param formula: Required. A formula for the desired number of compute nodes in the pool. - :type formula: str - :param evaluation_interval: If omitted, the default value is 15 minutes (PT15M). - :type evaluation_interval: ~datetime.timedelta - """ - - _validation = { - 'formula': {'required': True}, - } - - _attribute_map = { - 'formula': {'key': 'formula', 'type': 'str'}, - 'evaluation_interval': {'key': 'evaluationInterval', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoScaleSettings, self).__init__(**kwargs) - self.formula = kwargs['formula'] - self.evaluation_interval = kwargs.get('evaluation_interval', None) - - -class AutoStorageBaseProperties(msrest.serialization.Model): - """The properties related to the auto-storage account. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_id: Required. The resource ID of the storage account to be used for - auto-storage account. - :type storage_account_id: str - :param authentication_mode: The authentication mode which the Batch service will use to manage - the auto-storage account. Possible values include: "StorageKeys", - "BatchAccountManagedIdentity". Default value: "StorageKeys". - :type authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode - :param node_identity_reference: The identity referenced here must be assigned to pools which - have compute nodes that need access to auto-storage. - :type node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - """ - - _validation = { - 'storage_account_id': {'required': True}, - } - - _attribute_map = { - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, - 'node_identity_reference': {'key': 'nodeIdentityReference', 'type': 'ComputeNodeIdentityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoStorageBaseProperties, self).__init__(**kwargs) - self.storage_account_id = kwargs['storage_account_id'] - self.authentication_mode = kwargs.get('authentication_mode', "StorageKeys") - self.node_identity_reference = kwargs.get('node_identity_reference', None) - - -class AutoStorageProperties(AutoStorageBaseProperties): - """Contains information about the auto-storage account associated with a Batch account. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_id: Required. The resource ID of the storage account to be used for - auto-storage account. - :type storage_account_id: str - :param authentication_mode: The authentication mode which the Batch service will use to manage - the auto-storage account. Possible values include: "StorageKeys", - "BatchAccountManagedIdentity". Default value: "StorageKeys". - :type authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode - :param node_identity_reference: The identity referenced here must be assigned to pools which - have compute nodes that need access to auto-storage. - :type node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - :param last_key_sync: Required. The UTC time at which storage keys were last synchronized with - the Batch account. - :type last_key_sync: ~datetime.datetime - """ - - _validation = { - 'storage_account_id': {'required': True}, - 'last_key_sync': {'required': True}, - } - - _attribute_map = { - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'authentication_mode': {'key': 'authenticationMode', 'type': 'str'}, - 'node_identity_reference': {'key': 'nodeIdentityReference', 'type': 'ComputeNodeIdentityReference'}, - 'last_key_sync': {'key': 'lastKeySync', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoStorageProperties, self).__init__(**kwargs) - self.last_key_sync = kwargs['last_key_sync'] - - -class AutoUserSpecification(msrest.serialization.Model): - """Specifies the parameters for the auto user that runs a task on the Batch service. - - :param scope: The default value is Pool. If the pool is running Windows a value of Task should - be specified if stricter isolation between tasks is required. For example, if the task mutates - the registry in a way which could impact other tasks, or if certificates have been specified on - the pool which should not be accessible by normal tasks but should be accessible by start - tasks. Possible values include: "Task", "Pool". - :type scope: str or ~azure.mgmt.batch.models.AutoUserScope - :param elevation_level: The default value is nonAdmin. Possible values include: "NonAdmin", - "Admin". - :type elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel - """ - - _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'elevation_level': {'key': 'elevationLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoUserSpecification, self).__init__(**kwargs) - self.scope = kwargs.get('scope', None) - self.elevation_level = kwargs.get('elevation_level', None) - - -class AzureBlobFileSystemConfiguration(msrest.serialization.Model): - """Information used to connect to an Azure Storage Container using Blobfuse. - - All required parameters must be populated in order to send to Azure. - - :param account_name: Required. The Azure Storage Account name. - :type account_name: str - :param container_name: Required. The Azure Blob Storage Container name. - :type container_name: str - :param account_key: This property is mutually exclusive with both sasKey and identity; exactly - one must be specified. - :type account_key: str - :param sas_key: This property is mutually exclusive with both accountKey and identity; exactly - one must be specified. - :type sas_key: str - :param blobfuse_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type blobfuse_options: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts - directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param identity_reference: This property is mutually exclusive with both accountKey and sasKey; - exactly one must be specified. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - """ - - _validation = { - 'account_name': {'required': True}, - 'container_name': {'required': True}, - 'relative_mount_path': {'required': True}, - } - - _attribute_map = { - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'account_key': {'key': 'accountKey', 'type': 'str'}, - 'sas_key': {'key': 'sasKey', 'type': 'str'}, - 'blobfuse_options': {'key': 'blobfuseOptions', 'type': 'str'}, - 'relative_mount_path': {'key': 'relativeMountPath', 'type': 'str'}, - 'identity_reference': {'key': 'identityReference', 'type': 'ComputeNodeIdentityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureBlobFileSystemConfiguration, self).__init__(**kwargs) - self.account_name = kwargs['account_name'] - self.container_name = kwargs['container_name'] - self.account_key = kwargs.get('account_key', None) - self.sas_key = kwargs.get('sas_key', None) - self.blobfuse_options = kwargs.get('blobfuse_options', None) - self.relative_mount_path = kwargs['relative_mount_path'] - self.identity_reference = kwargs.get('identity_reference', None) - - -class AzureFileShareConfiguration(msrest.serialization.Model): - """Information used to connect to an Azure Fileshare. - - All required parameters must be populated in order to send to Azure. - - :param account_name: Required. The Azure Storage account name. - :type account_name: str - :param azure_file_url: Required. This is of the form - 'https://{account}.file.core.windows.net/'. - :type azure_file_url: str - :param account_key: Required. The Azure Storage account key. - :type account_key: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts - directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str - """ - - _validation = { - 'account_name': {'required': True}, - 'azure_file_url': {'required': True}, - 'account_key': {'required': True}, - 'relative_mount_path': {'required': True}, - } - - _attribute_map = { - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'azure_file_url': {'key': 'azureFileUrl', 'type': 'str'}, - 'account_key': {'key': 'accountKey', 'type': 'str'}, - 'relative_mount_path': {'key': 'relativeMountPath', 'type': 'str'}, - 'mount_options': {'key': 'mountOptions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFileShareConfiguration, self).__init__(**kwargs) - self.account_name = kwargs['account_name'] - self.azure_file_url = kwargs['azure_file_url'] - self.account_key = kwargs['account_key'] - self.relative_mount_path = kwargs['relative_mount_path'] - self.mount_options = kwargs.get('mount_options', None) - - -class Resource(msrest.serialization.Model): - """A definition of an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: A set of tags. The tags of the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class BatchAccount(Resource): - """Contains information about an Azure Batch account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. - :vartype location: str - :ivar tags: A set of tags. The tags of the resource. - :vartype tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity - :ivar account_endpoint: The account endpoint used to interact with the Batch service. - :vartype account_endpoint: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Invalid", "Creating", "Deleting", "Succeeded", "Failed", "Cancelled". - :vartype provisioning_state: str or ~azure.mgmt.batch.models.ProvisioningState - :ivar pool_allocation_mode: The allocation mode for creating pools in the Batch account. - Possible values include: "BatchService", "UserSubscription". - :vartype pool_allocation_mode: str or ~azure.mgmt.batch.models.PoolAllocationMode - :ivar key_vault_reference: Identifies the Azure key vault associated with a Batch account. - :vartype key_vault_reference: ~azure.mgmt.batch.models.KeyVaultReference - :ivar public_network_access: If not specified, the default value is 'enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :vartype public_network_access: str or ~azure.mgmt.batch.models.PublicNetworkAccessType - :ivar private_endpoint_connections: List of private endpoint connections associated with the - Batch account. - :vartype private_endpoint_connections: list[~azure.mgmt.batch.models.PrivateEndpointConnection] - :ivar auto_storage: Contains information about the auto-storage account associated with a Batch - account. - :vartype auto_storage: ~azure.mgmt.batch.models.AutoStorageProperties - :ivar encryption: Configures how customer data is encrypted inside the Batch account. By - default, accounts are encrypted using a Microsoft managed key. For additional control, a - customer-managed key can be used instead. - :vartype encryption: ~azure.mgmt.batch.models.EncryptionProperties - :ivar dedicated_core_quota: For accounts with PoolAllocationMode set to UserSubscription, quota - is managed on the subscription so this value is not returned. - :vartype dedicated_core_quota: int - :ivar low_priority_core_quota: For accounts with PoolAllocationMode set to UserSubscription, - quota is managed on the subscription so this value is not returned. - :vartype low_priority_core_quota: int - :ivar dedicated_core_quota_per_vm_family: A list of the dedicated core quota per Virtual - Machine family for the Batch account. For accounts with PoolAllocationMode set to - UserSubscription, quota is managed on the subscription so this value is not returned. - :vartype dedicated_core_quota_per_vm_family: - list[~azure.mgmt.batch.models.VirtualMachineFamilyCoreQuota] - :ivar dedicated_core_quota_per_vm_family_enforced: Batch is transitioning its core quota system - for dedicated cores to be enforced per Virtual Machine family. During this transitional phase, - the dedicated core quota per Virtual Machine family may not yet be enforced. If this flag is - false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the account - and does not consider Virtual Machine family. If this flag is true, dedicated core quota is - enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old - dedicatedCoreQuota does not apply. - :vartype dedicated_core_quota_per_vm_family_enforced: bool - :ivar pool_quota: The pool quota for the Batch account. - :vartype pool_quota: int - :ivar active_job_and_job_schedule_quota: The active job and job schedule quota for the Batch - account. - :vartype active_job_and_job_schedule_quota: int - :ivar allowed_authentication_modes: List of allowed authentication modes for the Batch account - that can be used to authenticate with the data plane. This does not affect authentication with - the control plane. - :vartype allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'account_endpoint': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'pool_allocation_mode': {'readonly': True}, - 'key_vault_reference': {'readonly': True}, - 'public_network_access': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'auto_storage': {'readonly': True}, - 'encryption': {'readonly': True}, - 'dedicated_core_quota': {'readonly': True}, - 'low_priority_core_quota': {'readonly': True}, - 'dedicated_core_quota_per_vm_family': {'readonly': True}, - 'dedicated_core_quota_per_vm_family_enforced': {'readonly': True}, - 'pool_quota': {'readonly': True}, - 'active_job_and_job_schedule_quota': {'readonly': True}, - 'allowed_authentication_modes': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'BatchAccountIdentity'}, - 'account_endpoint': {'key': 'properties.accountEndpoint', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'pool_allocation_mode': {'key': 'properties.poolAllocationMode', 'type': 'str'}, - 'key_vault_reference': {'key': 'properties.keyVaultReference', 'type': 'KeyVaultReference'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'auto_storage': {'key': 'properties.autoStorage', 'type': 'AutoStorageProperties'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'dedicated_core_quota': {'key': 'properties.dedicatedCoreQuota', 'type': 'int'}, - 'low_priority_core_quota': {'key': 'properties.lowPriorityCoreQuota', 'type': 'int'}, - 'dedicated_core_quota_per_vm_family': {'key': 'properties.dedicatedCoreQuotaPerVMFamily', 'type': '[VirtualMachineFamilyCoreQuota]'}, - 'dedicated_core_quota_per_vm_family_enforced': {'key': 'properties.dedicatedCoreQuotaPerVMFamilyEnforced', 'type': 'bool'}, - 'pool_quota': {'key': 'properties.poolQuota', 'type': 'int'}, - 'active_job_and_job_schedule_quota': {'key': 'properties.activeJobAndJobScheduleQuota', 'type': 'int'}, - 'allowed_authentication_modes': {'key': 'properties.allowedAuthenticationModes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccount, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.account_endpoint = None - self.provisioning_state = None - self.pool_allocation_mode = None - self.key_vault_reference = None - self.public_network_access = None - self.private_endpoint_connections = None - self.auto_storage = None - self.encryption = None - self.dedicated_core_quota = None - self.low_priority_core_quota = None - self.dedicated_core_quota_per_vm_family = None - self.dedicated_core_quota_per_vm_family_enforced = None - self.pool_quota = None - self.active_job_and_job_schedule_quota = None - self.allowed_authentication_modes = None - - -class BatchAccountCreateParameters(msrest.serialization.Model): - """Parameters supplied to the Create operation. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The region in which to create the account. - :type location: str - :param tags: A set of tags. The user-specified tags associated with the account. - :type tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity - :param auto_storage: The properties related to the auto-storage account. - :type auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties - :param pool_allocation_mode: The pool allocation mode also affects how clients may authenticate - to the Batch Service API. If the mode is BatchService, clients may authenticate using access - keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active - Directory. The default is BatchService. Possible values include: "BatchService", - "UserSubscription". - :type pool_allocation_mode: str or ~azure.mgmt.batch.models.PoolAllocationMode - :param key_vault_reference: A reference to the Azure key vault associated with the Batch - account. - :type key_vault_reference: ~azure.mgmt.batch.models.KeyVaultReference - :param public_network_access: If not specified, the default value is 'enabled'. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.batch.models.PublicNetworkAccessType - :param encryption: Configures how customer data is encrypted inside the Batch account. By - default, accounts are encrypted using a Microsoft managed key. For additional control, a - customer-managed key can be used instead. - :type encryption: ~azure.mgmt.batch.models.EncryptionProperties - :param allowed_authentication_modes: List of allowed authentication modes for the Batch account - that can be used to authenticate with the data plane. This does not affect authentication with - the control plane. - :type allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'BatchAccountIdentity'}, - 'auto_storage': {'key': 'properties.autoStorage', 'type': 'AutoStorageBaseProperties'}, - 'pool_allocation_mode': {'key': 'properties.poolAllocationMode', 'type': 'str'}, - 'key_vault_reference': {'key': 'properties.keyVaultReference', 'type': 'KeyVaultReference'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'allowed_authentication_modes': {'key': 'properties.allowedAuthenticationModes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountCreateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.auto_storage = kwargs.get('auto_storage', None) - self.pool_allocation_mode = kwargs.get('pool_allocation_mode', None) - self.key_vault_reference = kwargs.get('key_vault_reference', None) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.encryption = kwargs.get('encryption', None) - self.allowed_authentication_modes = kwargs.get('allowed_authentication_modes', None) - - -class BatchAccountIdentity(msrest.serialization.Model): - """The identity of the Batch account, if configured. This is used when the user specifies 'Microsoft.KeyVault' as their Batch account encryption configuration or when ``ManagedIdentity`` is selected as the auto-storage authentication mode. - - 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 principal_id: The principal id of the Batch account. This property will only be provided - for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the Batch account. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :param type: Required. The type of identity used for the Batch account. Possible values - include: "SystemAssigned", "UserAssigned", "None". - :type type: str or ~azure.mgmt.batch.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Batch account. - :type user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentities}'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class BatchAccountKeys(msrest.serialization.Model): - """A set of Azure Batch account keys. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_name: The Batch account name. - :vartype account_name: str - :ivar primary: The primary key associated with the account. - :vartype primary: str - :ivar secondary: The secondary key associated with the account. - :vartype secondary: str - """ - - _validation = { - 'account_name': {'readonly': True}, - 'primary': {'readonly': True}, - 'secondary': {'readonly': True}, - } - - _attribute_map = { - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'primary': {'key': 'primary', 'type': 'str'}, - 'secondary': {'key': 'secondary', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountKeys, self).__init__(**kwargs) - self.account_name = None - self.primary = None - self.secondary = None - - -class BatchAccountListResult(msrest.serialization.Model): - """Values returned by the List operation. - - :param value: The collection of Batch accounts returned by the listing operation. - :type value: list[~azure.mgmt.batch.models.BatchAccount] - :param next_link: The continuation token. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BatchAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BatchAccountRegenerateKeyParameters(msrest.serialization.Model): - """Parameters supplied to the RegenerateKey operation. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The type of account key to regenerate. Possible values include: - "Primary", "Secondary". - :type key_name: str or ~azure.mgmt.batch.models.AccountKeyType - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs['key_name'] - - -class BatchAccountUpdateParameters(msrest.serialization.Model): - """Parameters for updating an Azure Batch account. - - :param tags: A set of tags. The user-specified tags associated with the account. - :type tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity - :param auto_storage: The properties related to the auto-storage account. - :type auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties - :param encryption: Configures how customer data is encrypted inside the Batch account. By - default, accounts are encrypted using a Microsoft managed key. For additional control, a - customer-managed key can be used instead. - :type encryption: ~azure.mgmt.batch.models.EncryptionProperties - :param allowed_authentication_modes: List of allowed authentication modes for the Batch account - that can be used to authenticate with the data plane. This does not affect authentication with - the control plane. - :type allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'BatchAccountIdentity'}, - 'auto_storage': {'key': 'properties.autoStorage', 'type': 'AutoStorageBaseProperties'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, - 'allowed_authentication_modes': {'key': 'properties.allowedAuthenticationModes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchAccountUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.auto_storage = kwargs.get('auto_storage', None) - self.encryption = kwargs.get('encryption', None) - self.allowed_authentication_modes = kwargs.get('allowed_authentication_modes', None) - - -class BatchLocationQuota(msrest.serialization.Model): - """Quotas associated with a Batch region for a particular subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar account_quota: The number of Batch accounts that may be created under the subscription in - the specified region. - :vartype account_quota: int - """ - - _validation = { - 'account_quota': {'readonly': True}, - } - - _attribute_map = { - 'account_quota': {'key': 'accountQuota', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchLocationQuota, self).__init__(**kwargs) - self.account_quota = None - - -class BatchPoolIdentity(msrest.serialization.Model): - """The identity of the Batch pool, if configured. If the pool identity is updated during update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the updated identities. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of identity used for the Batch Pool. Possible values include: - "UserAssigned", "None". - :type type: str or ~azure.mgmt.batch.models.PoolIdentityType - :param user_assigned_identities: The list of user identities associated with the Batch pool. - :type user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentities}'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchPoolIdentity, self).__init__(**kwargs) - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class Certificate(ProxyResource): - """Contains information about a certificate. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :param thumbprint_algorithm: This must match the first portion of the certificate name. - Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is - Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.batch.models.CertificateProvisioningState - :ivar provisioning_state_transition_time: The time at which the certificate entered its current - state. - :vartype provisioning_state_transition_time: ~datetime.datetime - :ivar previous_provisioning_state: The previous provisioned state of the resource. Possible - values include: "Succeeded", "Deleting", "Failed". - :vartype previous_provisioning_state: str or - ~azure.mgmt.batch.models.CertificateProvisioningState - :ivar previous_provisioning_state_transition_time: The time at which the certificate entered - its previous state. - :vartype previous_provisioning_state_transition_time: ~datetime.datetime - :ivar public_data: The public key of the certificate. - :vartype public_data: str - :ivar delete_certificate_error: This is only returned when the certificate provisioningState is - 'Failed'. - :vartype delete_certificate_error: ~azure.mgmt.batch.models.DeleteCertificateError - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_state_transition_time': {'readonly': True}, - 'previous_provisioning_state': {'readonly': True}, - 'previous_provisioning_state_transition_time': {'readonly': True}, - 'public_data': {'readonly': True}, - 'delete_certificate_error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'thumbprint_algorithm': {'key': 'properties.thumbprintAlgorithm', 'type': 'str'}, - 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, - 'format': {'key': 'properties.format', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'provisioning_state_transition_time': {'key': 'properties.provisioningStateTransitionTime', 'type': 'iso-8601'}, - 'previous_provisioning_state': {'key': 'properties.previousProvisioningState', 'type': 'str'}, - 'previous_provisioning_state_transition_time': {'key': 'properties.previousProvisioningStateTransitionTime', 'type': 'iso-8601'}, - 'public_data': {'key': 'properties.publicData', 'type': 'str'}, - 'delete_certificate_error': {'key': 'properties.deleteCertificateError', 'type': 'DeleteCertificateError'}, - } - - def __init__( - self, - **kwargs - ): - super(Certificate, self).__init__(**kwargs) - self.thumbprint_algorithm = kwargs.get('thumbprint_algorithm', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.format = kwargs.get('format', None) - self.provisioning_state = None - self.provisioning_state_transition_time = None - self.previous_provisioning_state = None - self.previous_provisioning_state_transition_time = None - self.public_data = None - self.delete_certificate_error = None - - -class CertificateBaseProperties(msrest.serialization.Model): - """Base certificate properties. - - :param thumbprint_algorithm: This must match the first portion of the certificate name. - Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is - Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - """ - - _attribute_map = { - 'thumbprint_algorithm': {'key': 'thumbprintAlgorithm', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'format': {'key': 'format', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateBaseProperties, self).__init__(**kwargs) - self.thumbprint_algorithm = kwargs.get('thumbprint_algorithm', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.format = kwargs.get('format', None) - - -class CertificateCreateOrUpdateParameters(ProxyResource): - """Contains information about a certificate. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :param thumbprint_algorithm: This must match the first portion of the certificate name. - Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is - Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :param data: The maximum size is 10KB. - :type data: str - :param password: This must not be specified if the certificate format is Cer. - :type password: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'thumbprint_algorithm': {'key': 'properties.thumbprintAlgorithm', 'type': 'str'}, - 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, - 'format': {'key': 'properties.format', 'type': 'str'}, - 'data': {'key': 'properties.data', 'type': 'str'}, - 'password': {'key': 'properties.password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs) - self.thumbprint_algorithm = kwargs.get('thumbprint_algorithm', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.format = kwargs.get('format', None) - self.data = kwargs.get('data', None) - self.password = kwargs.get('password', None) - - -class CertificateCreateOrUpdateProperties(CertificateBaseProperties): - """Certificate properties for create operations. - - All required parameters must be populated in order to send to Azure. - - :param thumbprint_algorithm: This must match the first portion of the certificate name. - Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is - Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :param data: Required. The maximum size is 10KB. - :type data: str - :param password: This must not be specified if the certificate format is Cer. - :type password: str - """ - - _validation = { - 'data': {'required': True}, - } - - _attribute_map = { - 'thumbprint_algorithm': {'key': 'thumbprintAlgorithm', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'format': {'key': 'format', 'type': 'str'}, - 'data': {'key': 'data', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateCreateOrUpdateProperties, self).__init__(**kwargs) - self.data = kwargs['data'] - self.password = kwargs.get('password', None) - - -class CertificateProperties(CertificateBaseProperties): - """Certificate properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param thumbprint_algorithm: This must match the first portion of the certificate name. - Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is - Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.batch.models.CertificateProvisioningState - :ivar provisioning_state_transition_time: The time at which the certificate entered its current - state. - :vartype provisioning_state_transition_time: ~datetime.datetime - :ivar previous_provisioning_state: The previous provisioned state of the resource. Possible - values include: "Succeeded", "Deleting", "Failed". - :vartype previous_provisioning_state: str or - ~azure.mgmt.batch.models.CertificateProvisioningState - :ivar previous_provisioning_state_transition_time: The time at which the certificate entered - its previous state. - :vartype previous_provisioning_state_transition_time: ~datetime.datetime - :ivar public_data: The public key of the certificate. - :vartype public_data: str - :ivar delete_certificate_error: This is only returned when the certificate provisioningState is - 'Failed'. - :vartype delete_certificate_error: ~azure.mgmt.batch.models.DeleteCertificateError - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'provisioning_state_transition_time': {'readonly': True}, - 'previous_provisioning_state': {'readonly': True}, - 'previous_provisioning_state_transition_time': {'readonly': True}, - 'public_data': {'readonly': True}, - 'delete_certificate_error': {'readonly': True}, - } - - _attribute_map = { - 'thumbprint_algorithm': {'key': 'thumbprintAlgorithm', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'format': {'key': 'format', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_state_transition_time': {'key': 'provisioningStateTransitionTime', 'type': 'iso-8601'}, - 'previous_provisioning_state': {'key': 'previousProvisioningState', 'type': 'str'}, - 'previous_provisioning_state_transition_time': {'key': 'previousProvisioningStateTransitionTime', 'type': 'iso-8601'}, - 'public_data': {'key': 'publicData', 'type': 'str'}, - 'delete_certificate_error': {'key': 'deleteCertificateError', 'type': 'DeleteCertificateError'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.provisioning_state_transition_time = None - self.previous_provisioning_state = None - self.previous_provisioning_state_transition_time = None - self.public_data = None - self.delete_certificate_error = None - - -class CertificateReference(msrest.serialization.Model): - """A reference to a certificate to be installed on compute nodes in a pool. This must exist inside the same account as the pool. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The fully qualified ID of the certificate to install on the pool. This - must be inside the same batch account as the pool. - :type id: str - :param store_location: The default value is currentUser. This property is applicable only for - pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with - virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the - certificates are stored in a directory inside the task working directory and an environment - variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For - certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home - directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. - Possible values include: "CurrentUser", "LocalMachine". - :type store_location: str or ~azure.mgmt.batch.models.CertificateStoreLocation - :param store_name: This property is applicable only for pools configured with Windows nodes - (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a - Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, - TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be - used. The default value is My. - :type store_name: str - :param visibility: Which user accounts on the compute node should have access to the private - data of the certificate. - :type visibility: list[str or ~azure.mgmt.batch.models.CertificateVisibility] - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'store_location': {'key': 'storeLocation', 'type': 'str'}, - 'store_name': {'key': 'storeName', 'type': 'str'}, - 'visibility': {'key': 'visibility', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.store_location = kwargs.get('store_location', None) - self.store_name = kwargs.get('store_name', None) - self.visibility = kwargs.get('visibility', None) - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Parameters for a check name availability request. - - 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. - - :param name: Required. The name to check for availability. - :type name: str - :ivar type: The resource type. Has constant value: "Microsoft.Batch/batchAccounts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Batch/batchAccounts" - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Gets a boolean value that indicates whether the name is available for you - to use. If true, the name is available. If false, the name has already been taken or invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: Gets the reason that a Batch account name could not be used. The Reason element - is only returned if NameAvailable is false. Possible values include: "Invalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.batch.models.NameAvailabilityReason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CIFSMountConfiguration(msrest.serialization.Model): - """Information used to connect to a CIFS file system. - - All required parameters must be populated in order to send to Azure. - - :param username: Required. The user to use for authentication against the CIFS file system. - :type username: str - :param source: Required. The URI of the file system to mount. - :type source: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts - directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str - :param password: Required. The password to use for authentication against the CIFS file system. - :type password: str - """ - - _validation = { - 'username': {'required': True}, - 'source': {'required': True}, - 'relative_mount_path': {'required': True}, - 'password': {'required': True}, - } - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'relative_mount_path': {'key': 'relativeMountPath', 'type': 'str'}, - 'mount_options': {'key': 'mountOptions', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CIFSMountConfiguration, self).__init__(**kwargs) - self.username = kwargs['username'] - self.source = kwargs['source'] - self.relative_mount_path = kwargs['relative_mount_path'] - self.mount_options = kwargs.get('mount_options', None) - self.password = kwargs['password'] - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Batch service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.batch.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class CloudServiceConfiguration(msrest.serialization.Model): - """The configuration for nodes in a pool based on the Azure Cloud Services platform. - - All required parameters must be populated in order to send to Azure. - - :param os_family: Required. Possible values are: 2 - OS Family 2, equivalent to Windows Server - 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to - Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, - equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases - (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). - :type os_family: str - :param os_version: The default value is * which specifies the latest operating system version - for the specified OS family. - :type os_version: str - """ - - _validation = { - 'os_family': {'required': True}, - } - - _attribute_map = { - 'os_family': {'key': 'osFamily', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudServiceConfiguration, self).__init__(**kwargs) - self.os_family = kwargs['os_family'] - self.os_version = kwargs.get('os_version', None) - - -class ComputeNodeIdentityReference(msrest.serialization.Model): - """The reference to a user assigned identity associated with the Batch pool which a compute node will use. - - :param resource_id: The ARM resource id of the user assigned identity. - :type resource_id: str - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeNodeIdentityReference, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - - -class ContainerConfiguration(msrest.serialization.Model): - """The configuration for container-enabled pools. - - 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 type: The container technology to be used. Has constant value: "DockerCompatible". - :vartype type: str - :param container_image_names: This is the full image reference, as would be specified to - "docker pull". An image will be sourced from the default Docker registry unless the image is - fully qualified with an alternative registry. - :type container_image_names: list[str] - :param container_registries: If any images must be downloaded from a private registry which - requires credentials, then those credentials must be provided here. - :type container_registries: list[~azure.mgmt.batch.models.ContainerRegistry] - """ - - _validation = { - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'container_image_names': {'key': 'containerImageNames', 'type': '[str]'}, - 'container_registries': {'key': 'containerRegistries', 'type': '[ContainerRegistry]'}, - } - - type = "DockerCompatible" - - def __init__( - self, - **kwargs - ): - super(ContainerConfiguration, self).__init__(**kwargs) - self.container_image_names = kwargs.get('container_image_names', None) - self.container_registries = kwargs.get('container_registries', None) - - -class ContainerRegistry(msrest.serialization.Model): - """A private container registry. - - :param user_name: The user name to log into the registry server. - :type user_name: str - :param password: The password to log into the registry server. - :type password: str - :param registry_server: If omitted, the default is "docker.io". - :type registry_server: str - :param identity_reference: The reference to a user assigned identity associated with the Batch - pool which a compute node will use. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - """ - - _attribute_map = { - 'user_name': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'registry_server': {'key': 'registryServer', 'type': 'str'}, - 'identity_reference': {'key': 'identityReference', 'type': 'ComputeNodeIdentityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerRegistry, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - self.registry_server = kwargs.get('registry_server', None) - self.identity_reference = kwargs.get('identity_reference', None) - - -class DataDisk(msrest.serialization.Model): - """Settings which will be used by the data disks associated to Compute Nodes in the Pool. When using attached data disks, you need to mount and format the disks from within a VM to use them. - - All required parameters must be populated in order to send to Azure. - - :param lun: Required. The lun is used to uniquely identify each data disk. If attaching - multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. - :type lun: int - :param caching: Values are: - - none - The caching mode for the disk is not enabled. - readOnly - The caching mode for the disk is read only. - readWrite - The caching mode for the disk is read and write. - - The default value for caching is none. For information about the caching options see: - https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. - Possible values include: "None", "ReadOnly", "ReadWrite". - :type caching: str or ~azure.mgmt.batch.models.CachingType - :param disk_size_gb: Required. The initial disk size in GB when creating new data disk. - :type disk_size_gb: int - :param storage_account_type: If omitted, the default is "Standard_LRS". Values are: - - Standard_LRS - The data disk should use standard locally redundant storage. - Premium_LRS - The data disk should use premium locally redundant storage. Possible values - include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.batch.models.StorageAccountType - """ - - _validation = { - 'lun': {'required': True}, - 'disk_size_gb': {'required': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'caching': {'key': 'caching', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDisk, self).__init__(**kwargs) - self.lun = kwargs['lun'] - self.caching = kwargs.get('caching', None) - self.disk_size_gb = kwargs['disk_size_gb'] - self.storage_account_type = kwargs.get('storage_account_type', None) - - -class DeleteCertificateError(msrest.serialization.Model): - """An error response from the Batch service. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. An identifier for the error. Codes are invariant and are intended to be - consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.batch.models.DeleteCertificateError] - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[DeleteCertificateError]'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteCertificateError, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class DeploymentConfiguration(msrest.serialization.Model): - """Deployment configuration properties. - - :param cloud_service_configuration: This property and virtualMachineConfiguration are mutually - exclusive and one of the properties must be specified. This property cannot be specified if the - Batch account was created with its poolAllocationMode property set to 'UserSubscription'. - :type cloud_service_configuration: ~azure.mgmt.batch.models.CloudServiceConfiguration - :param virtual_machine_configuration: This property and cloudServiceConfiguration are mutually - exclusive and one of the properties must be specified. - :type virtual_machine_configuration: ~azure.mgmt.batch.models.VirtualMachineConfiguration - """ - - _attribute_map = { - 'cloud_service_configuration': {'key': 'cloudServiceConfiguration', 'type': 'CloudServiceConfiguration'}, - 'virtual_machine_configuration': {'key': 'virtualMachineConfiguration', 'type': 'VirtualMachineConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentConfiguration, self).__init__(**kwargs) - self.cloud_service_configuration = kwargs.get('cloud_service_configuration', None) - self.virtual_machine_configuration = kwargs.get('virtual_machine_configuration', None) - - -class DiffDiskSettings(msrest.serialization.Model): - """Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. - - :param placement: This property can be used by user in the request to choose which location the - operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For - more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size - requirements for Windows VMs at - https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements - and Linux VMs at - https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. - The only acceptable values to pass in are None and "CacheDisk". The default value is None. - :type placement: str - """ - - _attribute_map = { - 'placement': {'key': 'placement', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiffDiskSettings, self).__init__(**kwargs) - self.placement = kwargs.get('placement', None) - - -class DiskEncryptionConfiguration(msrest.serialization.Model): - """The disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image. - - :param targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and - "TemporaryDisk" must be specified. - :type targets: list[str or ~azure.mgmt.batch.models.DiskEncryptionTarget] - """ - - _attribute_map = { - 'targets': {'key': 'targets', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionConfiguration, self).__init__(**kwargs) - self.targets = kwargs.get('targets', None) - - -class EncryptionProperties(msrest.serialization.Model): - """Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - - :param key_source: Type of the key source. Possible values include: "Microsoft.Batch", - "Microsoft.KeyVault". - :type key_source: str or ~azure.mgmt.batch.models.KeySource - :param key_vault_properties: Additional details when using Microsoft.KeyVault. - :type key_vault_properties: ~azure.mgmt.batch.models.KeyVaultProperties - """ - - _attribute_map = { - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperties, self).__init__(**kwargs) - self.key_source = kwargs.get('key_source', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EndpointDependency(msrest.serialization.Model): - """A domain name and connection details used to access a dependency. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar domain_name: The domain name of the dependency. Domain names may be fully qualified or - may contain a * wildcard. - :vartype domain_name: str - :ivar description: Human-readable supplemental information about the dependency and when it is - applicable. - :vartype description: str - :ivar endpoint_details: The list of connection details for this endpoint. - :vartype endpoint_details: list[~azure.mgmt.batch.models.EndpointDetail] - """ - - _validation = { - 'domain_name': {'readonly': True}, - 'description': {'readonly': True}, - 'endpoint_details': {'readonly': True}, - } - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointDependency, self).__init__(**kwargs) - self.domain_name = None - self.description = None - self.endpoint_details = None - - -class EndpointDetail(msrest.serialization.Model): - """Details about the connection between the Batch service and the endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar port: The port an endpoint is connected to. - :vartype port: int - """ - - _validation = { - 'port': {'readonly': True}, - } - - _attribute_map = { - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointDetail, self).__init__(**kwargs) - self.port = None - - -class EnvironmentSetting(msrest.serialization.Model): - """An environment variable to be set on a task process. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the environment variable. - :type name: str - :param value: The value of the environment variable. - :type value: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentSetting, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs.get('value', None) - - -class FixedScaleSettings(msrest.serialization.Model): - """Fixed scale settings for the pool. - - :param resize_timeout: The default value is 15 minutes. Timeout values use ISO 8601 format. For - example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less - than 5 minutes, the Batch service rejects the request with an error; if you are calling the - REST API directly, the HTTP status code is 400 (Bad Request). - :type resize_timeout: ~datetime.timedelta - :param target_dedicated_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes - must be set. - :type target_dedicated_nodes: int - :param target_low_priority_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes - must be set. - :type target_low_priority_nodes: int - :param node_deallocation_option: If omitted, the default value is Requeue. Possible values - include: "Requeue", "Terminate", "TaskCompletion", "RetainedData". - :type node_deallocation_option: str or ~azure.mgmt.batch.models.ComputeNodeDeallocationOption - """ - - _attribute_map = { - 'resize_timeout': {'key': 'resizeTimeout', 'type': 'duration'}, - 'target_dedicated_nodes': {'key': 'targetDedicatedNodes', 'type': 'int'}, - 'target_low_priority_nodes': {'key': 'targetLowPriorityNodes', 'type': 'int'}, - 'node_deallocation_option': {'key': 'nodeDeallocationOption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FixedScaleSettings, self).__init__(**kwargs) - self.resize_timeout = kwargs.get('resize_timeout', None) - self.target_dedicated_nodes = kwargs.get('target_dedicated_nodes', None) - self.target_low_priority_nodes = kwargs.get('target_low_priority_nodes', None) - self.node_deallocation_option = kwargs.get('node_deallocation_option', None) - - -class ImageReference(msrest.serialization.Model): - """A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. - - :param publisher: For example, Canonical or MicrosoftWindowsServer. - :type publisher: str - :param offer: For example, UbuntuServer or WindowsServer. - :type offer: str - :param sku: For example, 18.04-LTS or 2019-Datacenter. - :type sku: str - :param version: A value of 'latest' can be specified to select the latest version of an image. - If omitted, the default is 'latest'. - :type version: str - :param id: This property is mutually exclusive with other properties. The Shared Image Gallery - image must have replicas in the same region as the Azure Batch account. For information about - the firewall settings for the Batch node agent to communicate with the Batch service see - https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - :type id: str - """ - - _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'offer': {'key': 'offer', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageReference, self).__init__(**kwargs) - self.publisher = kwargs.get('publisher', None) - self.offer = kwargs.get('offer', None) - self.sku = kwargs.get('sku', None) - self.version = kwargs.get('version', None) - self.id = kwargs.get('id', None) - - -class InboundNatPool(msrest.serialization.Model): - """A inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool externally. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name must be unique within a Batch pool, can contain letters, - numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end - with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values - are provided the request fails with HTTP status code 400. - :type name: str - :param protocol: Required. The protocol of the endpoint. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.batch.models.InboundEndpointProtocol - :param backend_port: Required. This must be unique within a Batch pool. Acceptable values are - between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved - values are provided the request fails with HTTP status code 400. - :type backend_port: int - :param frontend_port_range_start: Required. Acceptable values range between 1 and 65534 except - ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and - cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP - status code 400. - :type frontend_port_range_start: int - :param frontend_port_range_end: Required. Acceptable values range between 1 and 65534 except - ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool - must be distinct and cannot overlap. If any reserved or overlapping values are provided the - request fails with HTTP status code 400. - :type frontend_port_range_end: int - :param network_security_group_rules: The maximum number of rules that can be specified across - all the endpoints on a Batch pool is 25. If no network security group rules are specified, a - default rule will be created to allow inbound access to the specified backendPort. If the - maximum number of network security group rules is exceeded the request fails with HTTP status - code 400. - :type network_security_group_rules: list[~azure.mgmt.batch.models.NetworkSecurityGroupRule] - """ - - _validation = { - 'name': {'required': True}, - 'protocol': {'required': True}, - 'backend_port': {'required': True}, - 'frontend_port_range_start': {'required': True}, - 'frontend_port_range_end': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'backend_port': {'key': 'backendPort', 'type': 'int'}, - 'frontend_port_range_start': {'key': 'frontendPortRangeStart', 'type': 'int'}, - 'frontend_port_range_end': {'key': 'frontendPortRangeEnd', 'type': 'int'}, - 'network_security_group_rules': {'key': 'networkSecurityGroupRules', 'type': '[NetworkSecurityGroupRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(InboundNatPool, self).__init__(**kwargs) - self.name = kwargs['name'] - self.protocol = kwargs['protocol'] - self.backend_port = kwargs['backend_port'] - self.frontend_port_range_start = kwargs['frontend_port_range_start'] - self.frontend_port_range_end = kwargs['frontend_port_range_end'] - self.network_security_group_rules = kwargs.get('network_security_group_rules', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. - - :param key_identifier: Full path to the versioned secret. Example - https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable - the following prerequisites must be met: - - The Batch Account has a System Assigned identity - The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions - The KeyVault has soft-delete and purge protection enabled. - :type key_identifier: str - """ - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - - -class KeyVaultReference(msrest.serialization.Model): - """Identifies the Azure key vault associated with a Batch account. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The resource ID of the Azure key vault associated with the Batch account. - :type id: str - :param url: Required. The URL of the Azure key vault associated with the Batch account. - :type url: str - """ - - _validation = { - 'id': {'required': True}, - 'url': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultReference, self).__init__(**kwargs) - self.id = kwargs['id'] - self.url = kwargs['url'] - - -class LinuxUserConfiguration(msrest.serialization.Model): - """Properties used to create a user account on a Linux node. - - :param uid: The uid and gid properties must be specified together or not at all. If not - specified the underlying operating system picks the uid. - :type uid: int - :param gid: The uid and gid properties must be specified together or not at all. If not - specified the underlying operating system picks the gid. - :type gid: int - :param ssh_private_key: The private key must not be password protected. The private key is used - to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux - pool when the pool's enableInterNodeCommunication property is true (it is ignored if - enableInterNodeCommunication is false). It does this by placing the key pair into the user's - .ssh directory. If not specified, password-less SSH is not configured between nodes (no - modification of the user's .ssh directory is done). - :type ssh_private_key: str - """ - - _attribute_map = { - 'uid': {'key': 'uid', 'type': 'int'}, - 'gid': {'key': 'gid', 'type': 'int'}, - 'ssh_private_key': {'key': 'sshPrivateKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinuxUserConfiguration, self).__init__(**kwargs) - self.uid = kwargs.get('uid', None) - self.gid = kwargs.get('gid', None) - self.ssh_private_key = kwargs.get('ssh_private_key', None) - - -class ListApplicationPackagesResult(msrest.serialization.Model): - """The result of performing list application packages. - - :param value: The list of application packages. - :type value: list[~azure.mgmt.batch.models.ApplicationPackage] - :param next_link: The URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationPackage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListApplicationPackagesResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ListApplicationsResult(msrest.serialization.Model): - """The result of performing list applications. - - :param value: The list of applications. - :type value: list[~azure.mgmt.batch.models.Application] - :param next_link: The URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Application]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListApplicationsResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ListCertificatesResult(msrest.serialization.Model): - """Values returned by the List operation. - - :param value: The collection of returned certificates. - :type value: list[~azure.mgmt.batch.models.Certificate] - :param next_link: The continuation token. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Certificate]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListCertificatesResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ListPoolsResult(msrest.serialization.Model): - """Values returned by the List operation. - - :param value: The collection of returned pools. - :type value: list[~azure.mgmt.batch.models.Pool] - :param next_link: The continuation token. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Pool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListPoolsResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ListPrivateEndpointConnectionsResult(msrest.serialization.Model): - """Values returned by the List operation. - - :param value: The collection of returned private endpoint connection. - :type value: list[~azure.mgmt.batch.models.PrivateEndpointConnection] - :param next_link: The continuation token. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListPrivateEndpointConnectionsResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ListPrivateLinkResourcesResult(msrest.serialization.Model): - """Values returned by the List operation. - - :param value: The collection of returned private link resources. - :type value: list[~azure.mgmt.batch.models.PrivateLinkResource] - :param next_link: The continuation token. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListPrivateLinkResourcesResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MetadataItem(msrest.serialization.Model): - """The Batch service does not assign any meaning to this metadata; it is solely for the use of user code. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the metadata item. - :type name: str - :param value: Required. The value of the metadata item. - :type value: str - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetadataItem, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - - -class MountConfiguration(msrest.serialization.Model): - """The file system to mount on each node. - - :param azure_blob_file_system_configuration: This property is mutually exclusive with all other - properties. - :type azure_blob_file_system_configuration: - ~azure.mgmt.batch.models.AzureBlobFileSystemConfiguration - :param nfs_mount_configuration: This property is mutually exclusive with all other properties. - :type nfs_mount_configuration: ~azure.mgmt.batch.models.NFSMountConfiguration - :param cifs_mount_configuration: This property is mutually exclusive with all other properties. - :type cifs_mount_configuration: ~azure.mgmt.batch.models.CIFSMountConfiguration - :param azure_file_share_configuration: This property is mutually exclusive with all other - properties. - :type azure_file_share_configuration: ~azure.mgmt.batch.models.AzureFileShareConfiguration - """ - - _attribute_map = { - 'azure_blob_file_system_configuration': {'key': 'azureBlobFileSystemConfiguration', 'type': 'AzureBlobFileSystemConfiguration'}, - 'nfs_mount_configuration': {'key': 'nfsMountConfiguration', 'type': 'NFSMountConfiguration'}, - 'cifs_mount_configuration': {'key': 'cifsMountConfiguration', 'type': 'CIFSMountConfiguration'}, - 'azure_file_share_configuration': {'key': 'azureFileShareConfiguration', 'type': 'AzureFileShareConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(MountConfiguration, self).__init__(**kwargs) - self.azure_blob_file_system_configuration = kwargs.get('azure_blob_file_system_configuration', None) - self.nfs_mount_configuration = kwargs.get('nfs_mount_configuration', None) - self.cifs_mount_configuration = kwargs.get('cifs_mount_configuration', None) - self.azure_file_share_configuration = kwargs.get('azure_file_share_configuration', None) - - -class NetworkConfiguration(msrest.serialization.Model): - """The network configuration for a pool. - - :param subnet_id: The virtual network must be in the same region and subscription as the Azure - Batch account. The specified subnet should have enough free IP addresses to accommodate the - number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will - partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' - service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control - (RBAC) role for the specified VNet. The specified subnet must allow communication from the - Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by - checking if the specified VNet has any associated Network Security Groups (NSG). If - communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch - service will set the state of the compute nodes to unusable. If the specified VNet has any - associated Network Security Groups (NSG), then a few reserved system ports must be enabled for - inbound communication. For pools created with a virtual machine configuration, enable ports - 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with - a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound - connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' - VNETs are supported. For more details see: - https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - :type subnet_id: str - :param endpoint_configuration: Pool endpoint configuration is only supported on pools with the - virtualMachineConfiguration property. - :type endpoint_configuration: ~azure.mgmt.batch.models.PoolEndpointConfiguration - :param public_ip_address_configuration: This property is only supported on Pools with the - virtualMachineConfiguration property. - :type public_ip_address_configuration: ~azure.mgmt.batch.models.PublicIPAddressConfiguration - """ - - _attribute_map = { - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'endpoint_configuration': {'key': 'endpointConfiguration', 'type': 'PoolEndpointConfiguration'}, - 'public_ip_address_configuration': {'key': 'publicIPAddressConfiguration', 'type': 'PublicIPAddressConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkConfiguration, self).__init__(**kwargs) - self.subnet_id = kwargs.get('subnet_id', None) - self.endpoint_configuration = kwargs.get('endpoint_configuration', None) - self.public_ip_address_configuration = kwargs.get('public_ip_address_configuration', None) - - -class NetworkSecurityGroupRule(msrest.serialization.Model): - """A network security group rule to apply to an inbound endpoint. - - All required parameters must be populated in order to send to Azure. - - :param priority: Required. Priorities within a pool must be unique and are evaluated in order - of priority. The lower the number the higher the priority. For example, rules could be - specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes - precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any - reserved or duplicate values are provided the request fails with HTTP status code 400. - :type priority: int - :param access: Required. The action that should be taken for a specified IP address, subnet - range or tag. Possible values include: "Allow", "Deny". - :type access: str or ~azure.mgmt.batch.models.NetworkSecurityGroupRuleAccess - :param source_address_prefix: Required. Valid values are a single IP address (i.e. - 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any - other values are provided the request fails with HTTP status code 400. - :type source_address_prefix: str - :param source_port_ranges: Valid values are '\ *' (for all ports 0 - 65535) or arrays of ports - or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges - or ports can't overlap. If any other values are provided the request fails with HTTP status - code 400. Default value will be *. - :type source_port_ranges: list[str] - """ - - _validation = { - 'priority': {'required': True}, - 'access': {'required': True}, - 'source_address_prefix': {'required': True}, - } - - _attribute_map = { - 'priority': {'key': 'priority', 'type': 'int'}, - 'access': {'key': 'access', 'type': 'str'}, - 'source_address_prefix': {'key': 'sourceAddressPrefix', 'type': 'str'}, - 'source_port_ranges': {'key': 'sourcePortRanges', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkSecurityGroupRule, self).__init__(**kwargs) - self.priority = kwargs['priority'] - self.access = kwargs['access'] - self.source_address_prefix = kwargs['source_address_prefix'] - self.source_port_ranges = kwargs.get('source_port_ranges', None) - - -class NFSMountConfiguration(msrest.serialization.Model): - """Information used to connect to an NFS file system. - - All required parameters must be populated in order to send to Azure. - - :param source: Required. The URI of the file system to mount. - :type source: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts - directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str - """ - - _validation = { - 'source': {'required': True}, - 'relative_mount_path': {'required': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'str'}, - 'relative_mount_path': {'key': 'relativeMountPath', 'type': 'str'}, - 'mount_options': {'key': 'mountOptions', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NFSMountConfiguration, self).__init__(**kwargs) - self.source = kwargs['source'] - self.relative_mount_path = kwargs['relative_mount_path'] - self.mount_options = kwargs.get('mount_options', None) - - -class NodePlacementConfiguration(msrest.serialization.Model): - """Allocation configuration used by Batch Service to provision the nodes. - - :param policy: Allocation policy used by Batch Service to provision the nodes. If not - specified, Batch will use the regional policy. Possible values include: "Regional", "Zonal". - :type policy: str or ~azure.mgmt.batch.models.NodePlacementPolicyType - """ - - _attribute_map = { - 'policy': {'key': 'policy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NodePlacementConfiguration, self).__init__(**kwargs) - self.policy = kwargs.get('policy', None) - - -class Operation(msrest.serialization.Model): - """A REST API operation. - - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that describes the operation. - :type display: ~azure.mgmt.batch.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes the operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete, or listKeys/action. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - self.resource = kwargs.get('resource', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - - :param value: The list of operations supported by the resource provider. - :type value: list[~azure.mgmt.batch.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OSDisk(msrest.serialization.Model): - """Settings for the operating system disk of the virtual machine. - - :param ephemeral_os_disk_settings: Specifies the ephemeral Disk Settings for the operating - system disk used by the virtual machine. - :type ephemeral_os_disk_settings: ~azure.mgmt.batch.models.DiffDiskSettings - """ - - _attribute_map = { - 'ephemeral_os_disk_settings': {'key': 'ephemeralOSDiskSettings', 'type': 'DiffDiskSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(OSDisk, self).__init__(**kwargs) - self.ephemeral_os_disk_settings = kwargs.get('ephemeral_os_disk_settings', None) - - -class OutboundEnvironmentEndpoint(msrest.serialization.Model): - """A collection of related endpoints from the same service for which the Batch service requires outbound access. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar category: The type of service that the Batch service connects to. - :vartype category: str - :ivar endpoints: The endpoints for this service to which the Batch service makes outbound - calls. - :vartype endpoints: list[~azure.mgmt.batch.models.EndpointDependency] - """ - - _validation = { - 'category': {'readonly': True}, - 'endpoints': {'readonly': True}, - } - - _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, - } - - def __init__( - self, - **kwargs - ): - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) - self.category = None - self.endpoints = None - - -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): - """Values returned by the List operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The collection of outbound network dependency endpoints returned by the listing - operation. - :vartype value: list[~azure.mgmt.batch.models.OutboundEnvironmentEndpoint] - :param next_link: The continuation token. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Pool(ProxyResource): - """Contains information about a pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :param identity: The type of identity used for the Batch Pool. - :type identity: ~azure.mgmt.batch.models.BatchPoolIdentity - :param display_name: The display name need not be unique and can contain any Unicode characters - up to a maximum length of 1024. - :type display_name: str - :ivar last_modified: This is the last time at which the pool level data, such as the - targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes - such as a compute node changing state. - :vartype last_modified: ~datetime.datetime - :ivar creation_time: The creation time of the pool. - :vartype creation_time: ~datetime.datetime - :ivar provisioning_state: The current state of the pool. Possible values include: "Succeeded", - "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.batch.models.PoolProvisioningState - :ivar provisioning_state_transition_time: The time at which the pool entered its current state. - :vartype provisioning_state_transition_time: ~datetime.datetime - :ivar allocation_state: Whether the pool is resizing. Possible values include: "Steady", - "Resizing", "Stopping". - :vartype allocation_state: str or ~azure.mgmt.batch.models.AllocationState - :ivar allocation_state_transition_time: The time at which the pool entered its current - allocation state. - :vartype allocation_state_transition_time: ~datetime.datetime - :param vm_size: For information about available sizes of virtual machines for Cloud Services - pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services - (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch - supports all Cloud Services VM sizes except ExtraSmall. For information about available VM - sizes for pools using images from the Virtual Machines Marketplace (pools created with - virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) - (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for - Virtual Machines (Windows) - (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch - supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, - STANDARD_DS, and STANDARD_DSV2 series). - :type vm_size: str - :param deployment_configuration: Using CloudServiceConfiguration specifies that the nodes - should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses - Azure Virtual Machines (IaaS). - :type deployment_configuration: ~azure.mgmt.batch.models.DeploymentConfiguration - :ivar current_dedicated_nodes: The number of compute nodes currently in the pool. - :vartype current_dedicated_nodes: int - :ivar current_low_priority_nodes: The number of low-priority compute nodes currently in the - pool. - :vartype current_low_priority_nodes: int - :param scale_settings: Defines the desired size of the pool. This can either be 'fixedScale' - where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula - which is periodically reevaluated. If this property is not specified, the pool will have a - fixed scale with 0 targetDedicatedNodes. - :type scale_settings: ~azure.mgmt.batch.models.ScaleSettings - :ivar auto_scale_run: This property is set only if the pool automatically scales, i.e. - autoScaleSettings are used. - :vartype auto_scale_run: ~azure.mgmt.batch.models.AutoScaleRun - :param inter_node_communication: This imposes restrictions on which nodes can be assigned to - the pool. Enabling this value can reduce the chance of the requested number of nodes to be - allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values - include: "Enabled", "Disabled". - :type inter_node_communication: str or ~azure.mgmt.batch.models.InterNodeCommunicationState - :param network_configuration: The network configuration for a pool. - :type network_configuration: ~azure.mgmt.batch.models.NetworkConfiguration - :param task_slots_per_node: The default value is 1. The maximum value is the smaller of 4 times - the number of cores of the vmSize of the pool or 256. - :type task_slots_per_node: int - :param task_scheduling_policy: If not specified, the default is spread. - :type task_scheduling_policy: ~azure.mgmt.batch.models.TaskSchedulingPolicy - :param user_accounts: The list of user accounts to be created on each node in the pool. - :type user_accounts: list[~azure.mgmt.batch.models.UserAccount] - :param metadata: The Batch service does not assign any meaning to metadata; it is solely for - the use of user code. - :type metadata: list[~azure.mgmt.batch.models.MetadataItem] - :param start_task: In an PATCH (update) operation, this property can be set to an empty object - to remove the start task from the pool. - :type start_task: ~azure.mgmt.batch.models.StartTask - :param certificates: For Windows compute nodes, the Batch service installs the certificates to - the specified certificate store and location. For Linux compute nodes, the certificates are - stored in a directory inside the task working directory and an environment variable - AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates - with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory - (e.g., /home/{user-name}/certs) and certificates are placed in that directory. - :type certificates: list[~azure.mgmt.batch.models.CertificateReference] - :param application_packages: Changes to application package references affect all new compute - nodes joining the pool, but do not affect compute nodes that are already in the pool until they - are rebooted or reimaged. There is a maximum of 10 application package references on any given - pool. - :type application_packages: list[~azure.mgmt.batch.models.ApplicationPackageReference] - :param application_licenses: The list of application licenses must be a subset of available - Batch service application licenses. If a license is requested which is not supported, pool - creation will fail. - :type application_licenses: list[str] - :ivar resize_operation_status: Describes either the current operation (if the pool - AllocationState is Resizing) or the previously completed operation (if the AllocationState is - Steady). - :vartype resize_operation_status: ~azure.mgmt.batch.models.ResizeOperationStatus - :param mount_configuration: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. - :type mount_configuration: list[~azure.mgmt.batch.models.MountConfiguration] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_state_transition_time': {'readonly': True}, - 'allocation_state': {'readonly': True}, - 'allocation_state_transition_time': {'readonly': True}, - 'current_dedicated_nodes': {'readonly': True}, - 'current_low_priority_nodes': {'readonly': True}, - 'auto_scale_run': {'readonly': True}, - 'resize_operation_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'BatchPoolIdentity'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'provisioning_state_transition_time': {'key': 'properties.provisioningStateTransitionTime', 'type': 'iso-8601'}, - 'allocation_state': {'key': 'properties.allocationState', 'type': 'str'}, - 'allocation_state_transition_time': {'key': 'properties.allocationStateTransitionTime', 'type': 'iso-8601'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'deployment_configuration': {'key': 'properties.deploymentConfiguration', 'type': 'DeploymentConfiguration'}, - 'current_dedicated_nodes': {'key': 'properties.currentDedicatedNodes', 'type': 'int'}, - 'current_low_priority_nodes': {'key': 'properties.currentLowPriorityNodes', 'type': 'int'}, - 'scale_settings': {'key': 'properties.scaleSettings', 'type': 'ScaleSettings'}, - 'auto_scale_run': {'key': 'properties.autoScaleRun', 'type': 'AutoScaleRun'}, - 'inter_node_communication': {'key': 'properties.interNodeCommunication', 'type': 'str'}, - 'network_configuration': {'key': 'properties.networkConfiguration', 'type': 'NetworkConfiguration'}, - 'task_slots_per_node': {'key': 'properties.taskSlotsPerNode', 'type': 'int'}, - 'task_scheduling_policy': {'key': 'properties.taskSchedulingPolicy', 'type': 'TaskSchedulingPolicy'}, - 'user_accounts': {'key': 'properties.userAccounts', 'type': '[UserAccount]'}, - 'metadata': {'key': 'properties.metadata', 'type': '[MetadataItem]'}, - 'start_task': {'key': 'properties.startTask', 'type': 'StartTask'}, - 'certificates': {'key': 'properties.certificates', 'type': '[CertificateReference]'}, - 'application_packages': {'key': 'properties.applicationPackages', 'type': '[ApplicationPackageReference]'}, - 'application_licenses': {'key': 'properties.applicationLicenses', 'type': '[str]'}, - 'resize_operation_status': {'key': 'properties.resizeOperationStatus', 'type': 'ResizeOperationStatus'}, - 'mount_configuration': {'key': 'properties.mountConfiguration', 'type': '[MountConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(Pool, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.display_name = kwargs.get('display_name', None) - self.last_modified = None - self.creation_time = None - self.provisioning_state = None - self.provisioning_state_transition_time = None - self.allocation_state = None - self.allocation_state_transition_time = None - self.vm_size = kwargs.get('vm_size', None) - self.deployment_configuration = kwargs.get('deployment_configuration', None) - self.current_dedicated_nodes = None - self.current_low_priority_nodes = None - self.scale_settings = kwargs.get('scale_settings', None) - self.auto_scale_run = None - self.inter_node_communication = kwargs.get('inter_node_communication', None) - self.network_configuration = kwargs.get('network_configuration', None) - self.task_slots_per_node = kwargs.get('task_slots_per_node', None) - self.task_scheduling_policy = kwargs.get('task_scheduling_policy', None) - self.user_accounts = kwargs.get('user_accounts', None) - self.metadata = kwargs.get('metadata', None) - self.start_task = kwargs.get('start_task', None) - self.certificates = kwargs.get('certificates', None) - self.application_packages = kwargs.get('application_packages', None) - self.application_licenses = kwargs.get('application_licenses', None) - self.resize_operation_status = None - self.mount_configuration = kwargs.get('mount_configuration', None) - - -class PoolEndpointConfiguration(msrest.serialization.Model): - """The endpoint configuration for a pool. - - All required parameters must be populated in order to send to Azure. - - :param inbound_nat_pools: Required. The maximum number of inbound NAT pools per Batch pool is - 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status - code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. - :type inbound_nat_pools: list[~azure.mgmt.batch.models.InboundNatPool] - """ - - _validation = { - 'inbound_nat_pools': {'required': True}, - } - - _attribute_map = { - 'inbound_nat_pools': {'key': 'inboundNatPools', 'type': '[InboundNatPool]'}, - } - - def __init__( - self, - **kwargs - ): - super(PoolEndpointConfiguration, self).__init__(**kwargs) - self.inbound_nat_pools = kwargs['inbound_nat_pools'] - - -class PrivateEndpoint(msrest.serialization.Model): - """The private endpoint of the private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM resource identifier of the private endpoint. This is of the form - /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(ProxyResource): - """Contains information about a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :ivar provisioning_state: The provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Updating", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.batch.models.PrivateEndpointConnectionProvisioningState - :param private_endpoint: The private endpoint of the private endpoint connection. - :type private_endpoint: ~azure.mgmt.batch.models.PrivateEndpoint - :param private_link_service_connection_state: The private link service connection state of the - private endpoint connection. - :type private_link_service_connection_state: - ~azure.mgmt.batch.models.PrivateLinkServiceConnectionState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.provisioning_state = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - - -class PrivateLinkResource(ProxyResource): - """Contains information about a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar etag: The ETag of the resource, used for concurrency statements. - :vartype etag: str - :ivar group_id: The group id is used to establish the private link connection. - :vartype group_id: str - :ivar required_members: The list of required members that are used to establish the private - link connection. - :vartype required_members: list[str] - :ivar required_zone_names: The list of required zone names for the private DNS resource name. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The private link service connection state of the private endpoint connection. - - 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. - - :param status: Required. The status of the Batch private endpoint connection. Possible values - include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.batch.models.PrivateLinkServiceConnectionStatus - :param description: Description of the private Connection state. - :type description: str - :ivar action_required: Action required on the private connection state. - :vartype action_required: str - """ - - _validation = { - 'status': {'required': True}, - 'action_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs['status'] - self.description = kwargs.get('description', None) - self.action_required = None - - -class PublicIPAddressConfiguration(msrest.serialization.Model): - """The public IP Address configuration of the networking configuration of a Pool. - - :param provision: The default value is BatchManaged. Possible values include: "BatchManaged", - "UserManaged", "NoPublicIPAddresses". - :type provision: str or ~azure.mgmt.batch.models.IPAddressProvisioningType - :param ip_address_ids: The number of IPs specified here limits the maximum size of the Pool - - 100 dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, - a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of - this collection is of the form: - /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. - :type ip_address_ids: list[str] - """ - - _attribute_map = { - 'provision': {'key': 'provision', 'type': 'str'}, - 'ip_address_ids': {'key': 'ipAddressIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PublicIPAddressConfiguration, self).__init__(**kwargs) - self.provision = kwargs.get('provision', None) - self.ip_address_ids = kwargs.get('ip_address_ids', None) - - -class ResizeError(msrest.serialization.Model): - """An error that occurred when resizing a pool. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. An identifier for the error. Codes are invariant and are intended to be - consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param details: Additional details about the error. - :type details: list[~azure.mgmt.batch.models.ResizeError] - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ResizeError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResizeError, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.details = kwargs.get('details', None) - - -class ResizeOperationStatus(msrest.serialization.Model): - """Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed operation (if the AllocationState is Steady). - - :param target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. - :type target_dedicated_nodes: int - :param target_low_priority_nodes: The desired number of low-priority compute nodes in the pool. - :type target_low_priority_nodes: int - :param resize_timeout: The default value is 15 minutes. The minimum value is 5 minutes. If you - specify a value less than 5 minutes, the Batch service returns an error; if you are calling the - REST API directly, the HTTP status code is 400 (Bad Request). - :type resize_timeout: ~datetime.timedelta - :param node_deallocation_option: The default value is requeue. Possible values include: - "Requeue", "Terminate", "TaskCompletion", "RetainedData". - :type node_deallocation_option: str or ~azure.mgmt.batch.models.ComputeNodeDeallocationOption - :param start_time: The time when this resize operation was started. - :type start_time: ~datetime.datetime - :param errors: This property is set only if an error occurred during the last pool resize, and - only when the pool allocationState is Steady. - :type errors: list[~azure.mgmt.batch.models.ResizeError] - """ - - _attribute_map = { - 'target_dedicated_nodes': {'key': 'targetDedicatedNodes', 'type': 'int'}, - 'target_low_priority_nodes': {'key': 'targetLowPriorityNodes', 'type': 'int'}, - 'resize_timeout': {'key': 'resizeTimeout', 'type': 'duration'}, - 'node_deallocation_option': {'key': 'nodeDeallocationOption', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'errors': {'key': 'errors', 'type': '[ResizeError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResizeOperationStatus, self).__init__(**kwargs) - self.target_dedicated_nodes = kwargs.get('target_dedicated_nodes', None) - self.target_low_priority_nodes = kwargs.get('target_low_priority_nodes', None) - self.resize_timeout = kwargs.get('resize_timeout', None) - self.node_deallocation_option = kwargs.get('node_deallocation_option', None) - self.start_time = kwargs.get('start_time', None) - self.errors = kwargs.get('errors', None) - - -class ResourceFile(msrest.serialization.Model): - """A single file or multiple files to be downloaded to a compute node. - - :param auto_storage_container_name: The autoStorageContainerName, storageContainerUrl and - httpUrl properties are mutually exclusive and one of them must be specified. - :type auto_storage_container_name: str - :param storage_container_url: The autoStorageContainerName, storageContainerUrl and httpUrl - properties are mutually exclusive and one of them must be specified. This URL must be readable - and listable from compute nodes. There are three ways to get such a URL for a container in - Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on - the container, use a managed identity with read and list permissions, or set the ACL for the - container to allow public access. - :type storage_container_url: str - :param http_url: The autoStorageContainerName, storageContainerUrl and httpUrl properties are - mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, - it must be readable from compute nodes. There are three ways to get such a URL for a blob in - Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, - use a managed identity with read permission, or set the ACL for the blob or its container to - allow public access. - :type http_url: str - :param blob_prefix: The property is valid only when autoStorageContainerName or - storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a - prefix is not specified, all the files in the container will be downloaded. - :type blob_prefix: str - :param file_path: If the httpUrl property is specified, the filePath is required and describes - the path which the file will be downloaded to, including the filename. Otherwise, if the - autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and - is the directory to download the files to. In the case where filePath is used as a directory, - any directory structure already associated with the input data will be retained in full and - appended to the specified filePath directory. The specified relative path cannot break out of - the task's working directory (for example by using '..'). - :type file_path: str - :param file_mode: This property applies only to files being downloaded to Linux compute nodes. - It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows - node. If this property is not specified for a Linux node, then a default value of 0770 is - applied to the file. - :type file_mode: str - :param identity_reference: The reference to a user assigned identity associated with the Batch - pool which a compute node will use. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - """ - - _attribute_map = { - 'auto_storage_container_name': {'key': 'autoStorageContainerName', 'type': 'str'}, - 'storage_container_url': {'key': 'storageContainerUrl', 'type': 'str'}, - 'http_url': {'key': 'httpUrl', 'type': 'str'}, - 'blob_prefix': {'key': 'blobPrefix', 'type': 'str'}, - 'file_path': {'key': 'filePath', 'type': 'str'}, - 'file_mode': {'key': 'fileMode', 'type': 'str'}, - 'identity_reference': {'key': 'identityReference', 'type': 'ComputeNodeIdentityReference'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceFile, self).__init__(**kwargs) - self.auto_storage_container_name = kwargs.get('auto_storage_container_name', None) - self.storage_container_url = kwargs.get('storage_container_url', None) - self.http_url = kwargs.get('http_url', None) - self.blob_prefix = kwargs.get('blob_prefix', None) - self.file_path = kwargs.get('file_path', None) - self.file_mode = kwargs.get('file_mode', None) - self.identity_reference = kwargs.get('identity_reference', None) - - -class ScaleSettings(msrest.serialization.Model): - """Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. - - :param fixed_scale: This property and autoScale are mutually exclusive and one of the - properties must be specified. - :type fixed_scale: ~azure.mgmt.batch.models.FixedScaleSettings - :param auto_scale: This property and fixedScale are mutually exclusive and one of the - properties must be specified. - :type auto_scale: ~azure.mgmt.batch.models.AutoScaleSettings - """ - - _attribute_map = { - 'fixed_scale': {'key': 'fixedScale', 'type': 'FixedScaleSettings'}, - 'auto_scale': {'key': 'autoScale', 'type': 'AutoScaleSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(ScaleSettings, self).__init__(**kwargs) - self.fixed_scale = kwargs.get('fixed_scale', None) - self.auto_scale = kwargs.get('auto_scale', None) - - -class SkuCapability(msrest.serialization.Model): - """A SKU capability, such as the number of cores. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the feature. - :vartype name: str - :ivar value: The value of the feature. - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuCapability, self).__init__(**kwargs) - self.name = None - self.value = None - - -class StartTask(msrest.serialization.Model): - """In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task. - - :param command_line: The command line does not run under a shell, and therefore cannot take - advantage of shell features such as environment variable expansion. If you want to take - advantage of such features, you should invoke the shell in the command line, for example using - "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other - properties of the startTask are specified. - :type command_line: str - :param resource_files: A list of files that the Batch service will download to the compute node - before running the command line. - :type resource_files: list[~azure.mgmt.batch.models.ResourceFile] - :param environment_settings: A list of environment variable settings for the start task. - :type environment_settings: list[~azure.mgmt.batch.models.EnvironmentSetting] - :param user_identity: If omitted, the task runs as a non-administrative user unique to the - task. - :type user_identity: ~azure.mgmt.batch.models.UserIdentity - :param max_task_retry_count: The Batch service retries a task if its exit code is nonzero. Note - that this value specifically controls the number of retries. The Batch service will try the - task once, and may then retry up to this limit. For example, if the maximum retry count is 3, - Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count - is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch - service retries the task without limit. - :type max_task_retry_count: int - :param wait_for_success: If true and the start task fails on a compute node, the Batch service - retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still - not completed successfully after all retries, then the Batch service marks the compute node - unusable, and will not schedule tasks to it. This condition can be detected via the node state - and scheduling error detail. If false, the Batch service will not wait for the start task to - complete. In this case, other tasks can start executing on the compute node while the start - task is still running; and even if the start task fails, new tasks will continue to be - scheduled on the node. The default is true. - :type wait_for_success: bool - :param container_settings: When this is specified, all directories recursively below the - AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the - container, all task environment variables are mapped into the container, and the task command - line is executed in the container. - :type container_settings: ~azure.mgmt.batch.models.TaskContainerSettings - """ - - _attribute_map = { - 'command_line': {'key': 'commandLine', 'type': 'str'}, - 'resource_files': {'key': 'resourceFiles', 'type': '[ResourceFile]'}, - 'environment_settings': {'key': 'environmentSettings', 'type': '[EnvironmentSetting]'}, - 'user_identity': {'key': 'userIdentity', 'type': 'UserIdentity'}, - 'max_task_retry_count': {'key': 'maxTaskRetryCount', 'type': 'int'}, - 'wait_for_success': {'key': 'waitForSuccess', 'type': 'bool'}, - 'container_settings': {'key': 'containerSettings', 'type': 'TaskContainerSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(StartTask, self).__init__(**kwargs) - self.command_line = kwargs.get('command_line', None) - self.resource_files = kwargs.get('resource_files', None) - self.environment_settings = kwargs.get('environment_settings', None) - self.user_identity = kwargs.get('user_identity', None) - self.max_task_retry_count = kwargs.get('max_task_retry_count', None) - self.wait_for_success = kwargs.get('wait_for_success', None) - self.container_settings = kwargs.get('container_settings', None) - - -class SupportedSku(msrest.serialization.Model): - """Describes a Batch supported SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the SKU. - :vartype name: str - :ivar family_name: The family name of the SKU. - :vartype family_name: str - :ivar capabilities: A collection of capabilities which this SKU supports. - :vartype capabilities: list[~azure.mgmt.batch.models.SkuCapability] - """ - - _validation = { - 'name': {'readonly': True}, - 'family_name': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'family_name': {'key': 'familyName', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedSku, self).__init__(**kwargs) - self.name = None - self.family_name = None - self.capabilities = None - - -class SupportedSkusResult(msrest.serialization.Model): - """The Batch List supported SKUs operation 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. - - :param value: Required. The list of SKUs available for the Batch service in the location. - :type value: list[~azure.mgmt.batch.models.SupportedSku] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class TaskContainerSettings(msrest.serialization.Model): - """The container settings for a task. - - All required parameters must be populated in order to send to Azure. - - :param container_run_options: These additional options are supplied as arguments to the "docker - create" command, in addition to those controlled by the Batch Service. - :type container_run_options: str - :param image_name: Required. This is the full image reference, as would be specified to "docker - pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. - :type image_name: str - :param registry: This setting can be omitted if was already provided at pool creation. - :type registry: ~azure.mgmt.batch.models.ContainerRegistry - :param working_directory: A flag to indicate where the container task working directory is. The - default is 'taskWorkingDirectory'. Possible values include: "TaskWorkingDirectory", - "ContainerImageDefault". - :type working_directory: str or ~azure.mgmt.batch.models.ContainerWorkingDirectory - """ - - _validation = { - 'image_name': {'required': True}, - } - - _attribute_map = { - 'container_run_options': {'key': 'containerRunOptions', 'type': 'str'}, - 'image_name': {'key': 'imageName', 'type': 'str'}, - 'registry': {'key': 'registry', 'type': 'ContainerRegistry'}, - 'working_directory': {'key': 'workingDirectory', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskContainerSettings, self).__init__(**kwargs) - self.container_run_options = kwargs.get('container_run_options', None) - self.image_name = kwargs['image_name'] - self.registry = kwargs.get('registry', None) - self.working_directory = kwargs.get('working_directory', None) - - -class TaskSchedulingPolicy(msrest.serialization.Model): - """Specifies how tasks should be distributed across compute nodes. - - All required parameters must be populated in order to send to Azure. - - :param node_fill_type: Required. How tasks should be distributed across compute nodes. Possible - values include: "Spread", "Pack". - :type node_fill_type: str or ~azure.mgmt.batch.models.ComputeNodeFillType - """ - - _validation = { - 'node_fill_type': {'required': True}, - } - - _attribute_map = { - 'node_fill_type': {'key': 'nodeFillType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TaskSchedulingPolicy, self).__init__(**kwargs) - self.node_fill_type = kwargs['node_fill_type'] - - -class UserAccount(msrest.serialization.Model): - """Properties used to create a user on an Azure Batch node. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the user account. - :type name: str - :param password: Required. The password for the user account. - :type password: str - :param elevation_level: nonAdmin - The auto user is a standard user without elevated access. - admin - The auto user is a user with elevated access and operates with full Administrator - permissions. The default value is nonAdmin. Possible values include: "NonAdmin", "Admin". - :type elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel - :param linux_user_configuration: This property is ignored if specified on a Windows pool. If - not specified, the user is created with the default options. - :type linux_user_configuration: ~azure.mgmt.batch.models.LinuxUserConfiguration - :param windows_user_configuration: This property can only be specified if the user is on a - Windows pool. If not specified and on a Windows pool, the user is created with the default - options. - :type windows_user_configuration: ~azure.mgmt.batch.models.WindowsUserConfiguration - """ - - _validation = { - 'name': {'required': True}, - 'password': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'elevation_level': {'key': 'elevationLevel', 'type': 'str'}, - 'linux_user_configuration': {'key': 'linuxUserConfiguration', 'type': 'LinuxUserConfiguration'}, - 'windows_user_configuration': {'key': 'windowsUserConfiguration', 'type': 'WindowsUserConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAccount, self).__init__(**kwargs) - self.name = kwargs['name'] - self.password = kwargs['password'] - self.elevation_level = kwargs.get('elevation_level', None) - self.linux_user_configuration = kwargs.get('linux_user_configuration', None) - self.windows_user_configuration = kwargs.get('windows_user_configuration', None) - - -class UserAssignedIdentities(msrest.serialization.Model): - """The list of associated user identities. - - 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 - ): - super(UserAssignedIdentities, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class UserIdentity(msrest.serialization.Model): - """Specify either the userName or autoUser property, but not both. - - :param user_name: The userName and autoUser properties are mutually exclusive; you must specify - one but not both. - :type user_name: str - :param auto_user: The userName and autoUser properties are mutually exclusive; you must specify - one but not both. - :type auto_user: ~azure.mgmt.batch.models.AutoUserSpecification - """ - - _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'auto_user': {'key': 'autoUser', 'type': 'AutoUserSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentity, self).__init__(**kwargs) - self.user_name = kwargs.get('user_name', None) - self.auto_user = kwargs.get('auto_user', None) - - -class VirtualMachineConfiguration(msrest.serialization.Model): - """The configuration for compute nodes in a pool based on the Azure Virtual Machines infrastructure. - - All required parameters must be populated in order to send to Azure. - - :param image_reference: Required. A reference to an Azure Virtual Machines Marketplace image or - the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences - verified by Azure Batch, see the 'List supported node agent SKUs' operation. - :type image_reference: ~azure.mgmt.batch.models.ImageReference - :param node_agent_sku_id: Required. The Batch node agent is a program that runs on each node in - the pool, and provides the command-and-control interface between the node and the Batch - service. There are different implementations of the node agent, known as SKUs, for different - operating systems. You must specify a node agent SKU which matches the selected image - reference. To get the list of supported node agent SKUs along with their list of verified image - references, see the 'List supported node agent SKUs' operation. - :type node_agent_sku_id: str - :param windows_configuration: This property must not be specified if the imageReference - specifies a Linux OS image. - :type windows_configuration: ~azure.mgmt.batch.models.WindowsConfiguration - :param data_disks: This property must be specified if the compute nodes in the pool need to - have empty data disks attached to them. - :type data_disks: list[~azure.mgmt.batch.models.DataDisk] - :param license_type: This only applies to images that contain the Windows operating system, and - should only be used when you hold valid on-premises licenses for the nodes which will be - deployed. If omitted, no on-premises licensing discount is applied. Values are: - - Windows_Server - The on-premises license is for Windows Server. - Windows_Client - The on-premises license is for Windows Client. - :type license_type: str - :param container_configuration: If specified, setup is performed on each node in the pool to - allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must - specify the containerSettings property, and all other tasks may specify it. - :type container_configuration: ~azure.mgmt.batch.models.ContainerConfiguration - :param disk_encryption_configuration: If specified, encryption is performed on each node in the - pool during node provisioning. - :type disk_encryption_configuration: ~azure.mgmt.batch.models.DiskEncryptionConfiguration - :param node_placement_configuration: This configuration will specify rules on how nodes in the - pool will be physically allocated. - :type node_placement_configuration: ~azure.mgmt.batch.models.NodePlacementConfiguration - :param extensions: If specified, the extensions mentioned in this configuration will be - installed on each node. - :type extensions: list[~azure.mgmt.batch.models.VMExtension] - :param os_disk: Contains configuration for ephemeral OSDisk settings. - :type os_disk: ~azure.mgmt.batch.models.OSDisk - """ - - _validation = { - 'image_reference': {'required': True}, - 'node_agent_sku_id': {'required': True}, - } - - _attribute_map = { - 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, - 'node_agent_sku_id': {'key': 'nodeAgentSkuId', 'type': 'str'}, - 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, - 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'container_configuration': {'key': 'containerConfiguration', 'type': 'ContainerConfiguration'}, - 'disk_encryption_configuration': {'key': 'diskEncryptionConfiguration', 'type': 'DiskEncryptionConfiguration'}, - 'node_placement_configuration': {'key': 'nodePlacementConfiguration', 'type': 'NodePlacementConfiguration'}, - 'extensions': {'key': 'extensions', 'type': '[VMExtension]'}, - 'os_disk': {'key': 'osDisk', 'type': 'OSDisk'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineConfiguration, self).__init__(**kwargs) - self.image_reference = kwargs['image_reference'] - self.node_agent_sku_id = kwargs['node_agent_sku_id'] - self.windows_configuration = kwargs.get('windows_configuration', None) - self.data_disks = kwargs.get('data_disks', None) - self.license_type = kwargs.get('license_type', None) - self.container_configuration = kwargs.get('container_configuration', None) - self.disk_encryption_configuration = kwargs.get('disk_encryption_configuration', None) - self.node_placement_configuration = kwargs.get('node_placement_configuration', None) - self.extensions = kwargs.get('extensions', None) - self.os_disk = kwargs.get('os_disk', None) - - -class VirtualMachineFamilyCoreQuota(msrest.serialization.Model): - """A VM Family and its associated core quota for the Batch account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The Virtual Machine family name. - :vartype name: str - :ivar core_quota: The core quota for the VM family for the Batch account. - :vartype core_quota: int - """ - - _validation = { - 'name': {'readonly': True}, - 'core_quota': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'core_quota': {'key': 'coreQuota', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineFamilyCoreQuota, self).__init__(**kwargs) - self.name = None - self.core_quota = None - - -class VMExtension(msrest.serialization.Model): - """The configuration for virtual machine extensions. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the virtual machine extension. - :type name: str - :param publisher: Required. The name of the extension handler publisher. - :type publisher: str - :param type: Required. The type of the extensions. - :type type: str - :param type_handler_version: The version of script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Any object. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :type provision_after_extensions: list[str] - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'object'}, - 'provision_after_extensions': {'key': 'provisionAfterExtensions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VMExtension, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.type = kwargs['type'] - self.type_handler_version = kwargs.get('type_handler_version', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provision_after_extensions = kwargs.get('provision_after_extensions', None) - - -class WindowsConfiguration(msrest.serialization.Model): - """Windows operating system settings to apply to the virtual machine. - - :param enable_automatic_updates: If omitted, the default value is true. - :type enable_automatic_updates: bool - """ - - _attribute_map = { - 'enable_automatic_updates': {'key': 'enableAutomaticUpdates', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(WindowsConfiguration, self).__init__(**kwargs) - self.enable_automatic_updates = kwargs.get('enable_automatic_updates', None) - - -class WindowsUserConfiguration(msrest.serialization.Model): - """Properties used to create a user account on a Windows node. - - :param login_mode: Specifies login mode for the user. The default value for - VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools - is batch mode. Possible values include: "Batch", "Interactive". - :type login_mode: str or ~azure.mgmt.batch.models.LoginMode - """ - - _attribute_map = { - 'login_mode': {'key': 'loginMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WindowsUserConfiguration, self).__init__(**kwargs) - self.login_mode = kwargs.get('login_mode', None) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models_py3.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models_py3.py index d9aa5d0369e2..a2b860dcbf72 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models_py3.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/models/_models_py3.py @@ -19,8 +19,8 @@ class ActivateApplicationPackageParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: Required. The format of the application package binary file. - :type format: str + :ivar format: Required. The format of the application package binary file. + :vartype format: str """ _validation = { @@ -37,6 +37,10 @@ def __init__( format: str, **kwargs ): + """ + :keyword format: Required. The format of the application package binary file. + :paramtype format: str + """ super(ActivateApplicationPackageParameters, self).__init__(**kwargs) self.format = format @@ -74,6 +78,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -94,14 +100,14 @@ class Application(ProxyResource): :vartype type: str :ivar etag: The ETag of the resource, used for concurrency statements. :vartype etag: str - :param display_name: The display name for the application. - :type display_name: str - :param allow_updates: A value indicating whether packages within the application may be + :ivar display_name: The display name for the application. + :vartype display_name: str + :ivar allow_updates: A value indicating whether packages within the application may be overwritten using the same version string. - :type allow_updates: bool - :param default_version: The package to use if a client requests the application but does not + :vartype allow_updates: bool + :ivar default_version: The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. - :type default_version: str + :vartype default_version: str """ _validation = { @@ -129,6 +135,16 @@ def __init__( default_version: Optional[str] = None, **kwargs ): + """ + :keyword display_name: The display name for the application. + :paramtype display_name: str + :keyword allow_updates: A value indicating whether packages within the application may be + overwritten using the same version string. + :paramtype allow_updates: bool + :keyword default_version: The package to use if a client requests the application but does not + specify a version. This property can only be set to the name of an existing package. + :paramtype default_version: str + """ super(Application, self).__init__(**kwargs) self.display_name = display_name self.allow_updates = allow_updates @@ -190,6 +206,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationPackage, self).__init__(**kwargs) self.state = None self.format = None @@ -203,14 +221,14 @@ class ApplicationPackageReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The ID of the application package to install. This must be inside the same + :ivar id: Required. The ID of the application package to install. This must be inside the same batch account as the pool. This can either be a reference to a specific version or the default version if one exists. - :type id: str - :param version: If this is omitted, and no default version is specified for this application, + :vartype id: str + :ivar version: If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. - :type version: str + :vartype version: str """ _validation = { @@ -229,6 +247,16 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Required. The ID of the application package to install. This must be inside the + same batch account as the pool. This can either be a reference to a specific version or the + default version if one exists. + :paramtype id: str + :keyword version: If this is omitted, and no default version is specified for this application, + the request fails with the error code InvalidApplicationPackageReferences. If you are calling + the REST API directly, the HTTP status code is 409. + :paramtype version: str + """ super(ApplicationPackageReference, self).__init__(**kwargs) self.id = id self.version = version @@ -239,13 +267,13 @@ class AutoScaleRun(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param evaluation_time: Required. The time at which the autoscale formula was last evaluated. - :type evaluation_time: ~datetime.datetime - :param results: Each variable value is returned in the form $variable=value, and variables are + :ivar evaluation_time: Required. The time at which the autoscale formula was last evaluated. + :vartype evaluation_time: ~datetime.datetime + :ivar results: Each variable value is returned in the form $variable=value, and variables are separated by semicolons. - :type results: str - :param error: An error that occurred when autoscaling a pool. - :type error: ~azure.mgmt.batch.models.AutoScaleRunError + :vartype results: str + :ivar error: An error that occurred when autoscaling a pool. + :vartype error: ~azure.mgmt.batch.models.AutoScaleRunError """ _validation = { @@ -266,6 +294,15 @@ def __init__( error: Optional["AutoScaleRunError"] = None, **kwargs ): + """ + :keyword evaluation_time: Required. The time at which the autoscale formula was last evaluated. + :paramtype evaluation_time: ~datetime.datetime + :keyword results: Each variable value is returned in the form $variable=value, and variables + are separated by semicolons. + :paramtype results: str + :keyword error: An error that occurred when autoscaling a pool. + :paramtype error: ~azure.mgmt.batch.models.AutoScaleRunError + """ super(AutoScaleRun, self).__init__(**kwargs) self.evaluation_time = evaluation_time self.results = results @@ -277,14 +314,14 @@ class AutoScaleRunError(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. An identifier for the error. Codes are invariant and are intended to be + :ivar code: Required. An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param details: Additional details about the error. - :type details: list[~azure.mgmt.batch.models.AutoScaleRunError] + :vartype code: str + :ivar message: Required. A message describing the error, intended to be suitable for display in + a user interface. + :vartype message: str + :ivar details: Additional details about the error. + :vartype details: list[~azure.mgmt.batch.models.AutoScaleRunError] """ _validation = { @@ -306,6 +343,16 @@ def __init__( details: Optional[List["AutoScaleRunError"]] = None, **kwargs ): + """ + :keyword code: Required. An identifier for the error. Codes are invariant and are intended to + be consumed programmatically. + :paramtype code: str + :keyword message: Required. A message describing the error, intended to be suitable for display + in a user interface. + :paramtype message: str + :keyword details: Additional details about the error. + :paramtype details: list[~azure.mgmt.batch.models.AutoScaleRunError] + """ super(AutoScaleRunError, self).__init__(**kwargs) self.code = code self.message = message @@ -317,10 +364,10 @@ class AutoScaleSettings(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param formula: Required. A formula for the desired number of compute nodes in the pool. - :type formula: str - :param evaluation_interval: If omitted, the default value is 15 minutes (PT15M). - :type evaluation_interval: ~datetime.timedelta + :ivar formula: Required. A formula for the desired number of compute nodes in the pool. + :vartype formula: str + :ivar evaluation_interval: If omitted, the default value is 15 minutes (PT15M). + :vartype evaluation_interval: ~datetime.timedelta """ _validation = { @@ -339,6 +386,12 @@ def __init__( evaluation_interval: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword formula: Required. A formula for the desired number of compute nodes in the pool. + :paramtype formula: str + :keyword evaluation_interval: If omitted, the default value is 15 minutes (PT15M). + :paramtype evaluation_interval: ~datetime.timedelta + """ super(AutoScaleSettings, self).__init__(**kwargs) self.formula = formula self.evaluation_interval = evaluation_interval @@ -349,16 +402,16 @@ class AutoStorageBaseProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_id: Required. The resource ID of the storage account to be used for + :ivar storage_account_id: Required. The resource ID of the storage account to be used for auto-storage account. - :type storage_account_id: str - :param authentication_mode: The authentication mode which the Batch service will use to manage + :vartype storage_account_id: str + :ivar authentication_mode: The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: "StorageKeys", "BatchAccountManagedIdentity". Default value: "StorageKeys". - :type authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode - :param node_identity_reference: The identity referenced here must be assigned to pools which + :vartype authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode + :ivar node_identity_reference: The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - :type node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :vartype node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference """ _validation = { @@ -379,6 +432,18 @@ def __init__( node_identity_reference: Optional["ComputeNodeIdentityReference"] = None, **kwargs ): + """ + :keyword storage_account_id: Required. The resource ID of the storage account to be used for + auto-storage account. + :paramtype storage_account_id: str + :keyword authentication_mode: The authentication mode which the Batch service will use to + manage the auto-storage account. Possible values include: "StorageKeys", + "BatchAccountManagedIdentity". Default value: "StorageKeys". + :paramtype authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode + :keyword node_identity_reference: The identity referenced here must be assigned to pools which + have compute nodes that need access to auto-storage. + :paramtype node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + """ super(AutoStorageBaseProperties, self).__init__(**kwargs) self.storage_account_id = storage_account_id self.authentication_mode = authentication_mode @@ -390,19 +455,19 @@ class AutoStorageProperties(AutoStorageBaseProperties): All required parameters must be populated in order to send to Azure. - :param storage_account_id: Required. The resource ID of the storage account to be used for + :ivar storage_account_id: Required. The resource ID of the storage account to be used for auto-storage account. - :type storage_account_id: str - :param authentication_mode: The authentication mode which the Batch service will use to manage + :vartype storage_account_id: str + :ivar authentication_mode: The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: "StorageKeys", "BatchAccountManagedIdentity". Default value: "StorageKeys". - :type authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode - :param node_identity_reference: The identity referenced here must be assigned to pools which + :vartype authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode + :ivar node_identity_reference: The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - :type node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference - :param last_key_sync: Required. The UTC time at which storage keys were last synchronized with + :vartype node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :ivar last_key_sync: Required. The UTC time at which storage keys were last synchronized with the Batch account. - :type last_key_sync: ~datetime.datetime + :vartype last_key_sync: ~datetime.datetime """ _validation = { @@ -426,6 +491,21 @@ def __init__( node_identity_reference: Optional["ComputeNodeIdentityReference"] = None, **kwargs ): + """ + :keyword storage_account_id: Required. The resource ID of the storage account to be used for + auto-storage account. + :paramtype storage_account_id: str + :keyword authentication_mode: The authentication mode which the Batch service will use to + manage the auto-storage account. Possible values include: "StorageKeys", + "BatchAccountManagedIdentity". Default value: "StorageKeys". + :paramtype authentication_mode: str or ~azure.mgmt.batch.models.AutoStorageAuthenticationMode + :keyword node_identity_reference: The identity referenced here must be assigned to pools which + have compute nodes that need access to auto-storage. + :paramtype node_identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :keyword last_key_sync: Required. The UTC time at which storage keys were last synchronized + with the Batch account. + :paramtype last_key_sync: ~datetime.datetime + """ super(AutoStorageProperties, self).__init__(storage_account_id=storage_account_id, authentication_mode=authentication_mode, node_identity_reference=node_identity_reference, **kwargs) self.last_key_sync = last_key_sync @@ -433,15 +513,15 @@ def __init__( class AutoUserSpecification(msrest.serialization.Model): """Specifies the parameters for the auto user that runs a task on the Batch service. - :param scope: The default value is Pool. If the pool is running Windows a value of Task should + :ivar scope: The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. Possible values include: "Task", "Pool". - :type scope: str or ~azure.mgmt.batch.models.AutoUserScope - :param elevation_level: The default value is nonAdmin. Possible values include: "NonAdmin", + :vartype scope: str or ~azure.mgmt.batch.models.AutoUserScope + :ivar elevation_level: The default value is nonAdmin. Possible values include: "NonAdmin", "Admin". - :type elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel + :vartype elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel """ _attribute_map = { @@ -456,6 +536,17 @@ def __init__( elevation_level: Optional[Union[str, "ElevationLevel"]] = None, **kwargs ): + """ + :keyword scope: The default value is Pool. If the pool is running Windows a value of Task + should be specified if stricter isolation between tasks is required. For example, if the task + mutates the registry in a way which could impact other tasks, or if certificates have been + specified on the pool which should not be accessible by normal tasks but should be accessible + by start tasks. Possible values include: "Task", "Pool". + :paramtype scope: str or ~azure.mgmt.batch.models.AutoUserScope + :keyword elevation_level: The default value is nonAdmin. Possible values include: "NonAdmin", + "Admin". + :paramtype elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel + """ super(AutoUserSpecification, self).__init__(**kwargs) self.scope = scope self.elevation_level = elevation_level @@ -466,24 +557,24 @@ class AzureBlobFileSystemConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param account_name: Required. The Azure Storage Account name. - :type account_name: str - :param container_name: Required. The Azure Blob Storage Container name. - :type container_name: str - :param account_key: This property is mutually exclusive with both sasKey and identity; exactly + :ivar account_name: Required. The Azure Storage Account name. + :vartype account_name: str + :ivar container_name: Required. The Azure Blob Storage Container name. + :vartype container_name: str + :ivar account_key: This property is mutually exclusive with both sasKey and identity; exactly one must be specified. - :type account_key: str - :param sas_key: This property is mutually exclusive with both accountKey and identity; exactly + :vartype account_key: str + :ivar sas_key: This property is mutually exclusive with both accountKey and identity; exactly one must be specified. - :type sas_key: str - :param blobfuse_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type blobfuse_options: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts + :vartype sas_key: str + :ivar blobfuse_options: These are 'net use' options in Windows and 'mount' options in Linux. + :vartype blobfuse_options: str + :ivar relative_mount_path: Required. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param identity_reference: This property is mutually exclusive with both accountKey and sasKey; + :vartype relative_mount_path: str + :ivar identity_reference: This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :vartype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference """ _validation = { @@ -514,6 +605,26 @@ def __init__( identity_reference: Optional["ComputeNodeIdentityReference"] = None, **kwargs ): + """ + :keyword account_name: Required. The Azure Storage Account name. + :paramtype account_name: str + :keyword container_name: Required. The Azure Blob Storage Container name. + :paramtype container_name: str + :keyword account_key: This property is mutually exclusive with both sasKey and identity; + exactly one must be specified. + :paramtype account_key: str + :keyword sas_key: This property is mutually exclusive with both accountKey and identity; + exactly one must be specified. + :paramtype sas_key: str + :keyword blobfuse_options: These are 'net use' options in Windows and 'mount' options in Linux. + :paramtype blobfuse_options: str + :keyword relative_mount_path: Required. All file systems are mounted relative to the Batch + mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + :paramtype relative_mount_path: str + :keyword identity_reference: This property is mutually exclusive with both accountKey and + sasKey; exactly one must be specified. + :paramtype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + """ super(AzureBlobFileSystemConfiguration, self).__init__(**kwargs) self.account_name = account_name self.container_name = container_name @@ -529,18 +640,17 @@ class AzureFileShareConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param account_name: Required. The Azure Storage account name. - :type account_name: str - :param azure_file_url: Required. This is of the form - 'https://{account}.file.core.windows.net/'. - :type azure_file_url: str - :param account_key: Required. The Azure Storage account key. - :type account_key: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts + :ivar account_name: Required. The Azure Storage account name. + :vartype account_name: str + :ivar azure_file_url: Required. This is of the form 'https://{account}.file.core.windows.net/'. + :vartype azure_file_url: str + :ivar account_key: Required. The Azure Storage account key. + :vartype account_key: str + :ivar relative_mount_path: Required. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str + :vartype relative_mount_path: str + :ivar mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :vartype mount_options: str """ _validation = { @@ -568,6 +678,20 @@ def __init__( mount_options: Optional[str] = None, **kwargs ): + """ + :keyword account_name: Required. The Azure Storage account name. + :paramtype account_name: str + :keyword azure_file_url: Required. This is of the form + 'https://{account}.file.core.windows.net/'. + :paramtype azure_file_url: str + :keyword account_key: Required. The Azure Storage account key. + :paramtype account_key: str + :keyword relative_mount_path: Required. All file systems are mounted relative to the Batch + mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + :paramtype relative_mount_path: str + :keyword mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :paramtype mount_options: str + """ super(AzureFileShareConfiguration, self).__init__(**kwargs) self.account_name = account_name self.azure_file_url = azure_file_url @@ -613,6 +737,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -636,8 +762,8 @@ class BatchAccount(Resource): :vartype location: str :ivar tags: A set of tags. The tags of the resource. :vartype tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :ivar identity: The identity of the Batch account. + :vartype identity: ~azure.mgmt.batch.models.BatchAccountIdentity :ivar account_endpoint: The account endpoint used to interact with the Batch service. :vartype account_endpoint: str :ivar provisioning_state: The provisioned state of the resource. Possible values include: @@ -744,6 +870,10 @@ def __init__( identity: Optional["BatchAccountIdentity"] = None, **kwargs ): + """ + :keyword identity: The identity of the Batch account. + :paramtype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + """ super(BatchAccount, self).__init__(**kwargs) self.identity = identity self.account_endpoint = None @@ -768,34 +898,34 @@ class BatchAccountCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The region in which to create the account. - :type location: str - :param tags: A set of tags. The user-specified tags associated with the account. - :type tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity - :param auto_storage: The properties related to the auto-storage account. - :type auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties - :param pool_allocation_mode: The pool allocation mode also affects how clients may authenticate + :ivar location: Required. The region in which to create the account. + :vartype location: str + :ivar tags: A set of tags. The user-specified tags associated with the account. + :vartype tags: dict[str, str] + :ivar identity: The identity of the Batch account. + :vartype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :ivar auto_storage: The properties related to the auto-storage account. + :vartype auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties + :ivar pool_allocation_mode: The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: "BatchService", "UserSubscription". - :type pool_allocation_mode: str or ~azure.mgmt.batch.models.PoolAllocationMode - :param key_vault_reference: A reference to the Azure key vault associated with the Batch + :vartype pool_allocation_mode: str or ~azure.mgmt.batch.models.PoolAllocationMode + :ivar key_vault_reference: A reference to the Azure key vault associated with the Batch account. - :type key_vault_reference: ~azure.mgmt.batch.models.KeyVaultReference - :param public_network_access: If not specified, the default value is 'enabled'. Possible values + :vartype key_vault_reference: ~azure.mgmt.batch.models.KeyVaultReference + :ivar public_network_access: If not specified, the default value is 'enabled'. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.batch.models.PublicNetworkAccessType - :param encryption: Configures how customer data is encrypted inside the Batch account. By + :vartype public_network_access: str or ~azure.mgmt.batch.models.PublicNetworkAccessType + :ivar encryption: Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - :type encryption: ~azure.mgmt.batch.models.EncryptionProperties - :param allowed_authentication_modes: List of allowed authentication modes for the Batch account + :vartype encryption: ~azure.mgmt.batch.models.EncryptionProperties + :ivar allowed_authentication_modes: List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - :type allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] + :vartype allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] """ _validation = { @@ -828,6 +958,37 @@ def __init__( allowed_authentication_modes: Optional[List[Union[str, "AuthenticationMode"]]] = None, **kwargs ): + """ + :keyword location: Required. The region in which to create the account. + :paramtype location: str + :keyword tags: A set of tags. The user-specified tags associated with the account. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the Batch account. + :paramtype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :keyword auto_storage: The properties related to the auto-storage account. + :paramtype auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties + :keyword pool_allocation_mode: The pool allocation mode also affects how clients may + authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate + using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use + Azure Active Directory. The default is BatchService. Possible values include: "BatchService", + "UserSubscription". + :paramtype pool_allocation_mode: str or ~azure.mgmt.batch.models.PoolAllocationMode + :keyword key_vault_reference: A reference to the Azure key vault associated with the Batch + account. + :paramtype key_vault_reference: ~azure.mgmt.batch.models.KeyVaultReference + :keyword public_network_access: If not specified, the default value is 'enabled'. Possible + values include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype public_network_access: str or ~azure.mgmt.batch.models.PublicNetworkAccessType + :keyword encryption: Configures how customer data is encrypted inside the Batch account. By + default, accounts are encrypted using a Microsoft managed key. For additional control, a + customer-managed key can be used instead. + :paramtype encryption: ~azure.mgmt.batch.models.EncryptionProperties + :keyword allowed_authentication_modes: List of allowed authentication modes for the Batch + account that can be used to authenticate with the data plane. This does not affect + authentication with the control plane. + :paramtype allowed_authentication_modes: list[str or + ~azure.mgmt.batch.models.AuthenticationMode] + """ super(BatchAccountCreateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -853,11 +1014,11 @@ class BatchAccountIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id associated with the Batch account. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: Required. The type of identity used for the Batch account. Possible values - include: "SystemAssigned", "UserAssigned", "None". - :type type: str or ~azure.mgmt.batch.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the Batch account. - :type user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] + :ivar type: Required. The type of identity used for the Batch account. Possible values include: + "SystemAssigned", "UserAssigned", "None". + :vartype type: str or ~azure.mgmt.batch.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the Batch account. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] """ _validation = { @@ -880,6 +1041,14 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentities"]] = None, **kwargs ): + """ + :keyword type: Required. The type of identity used for the Batch account. Possible values + include: "SystemAssigned", "UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.batch.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the Batch + account. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] + """ super(BatchAccountIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -916,6 +1085,8 @@ def __init__( self, **kwargs ): + """ + """ super(BatchAccountKeys, self).__init__(**kwargs) self.account_name = None self.primary = None @@ -925,10 +1096,10 @@ def __init__( class BatchAccountListResult(msrest.serialization.Model): """Values returned by the List operation. - :param value: The collection of Batch accounts returned by the listing operation. - :type value: list[~azure.mgmt.batch.models.BatchAccount] - :param next_link: The continuation token. - :type next_link: str + :ivar value: The collection of Batch accounts returned by the listing operation. + :vartype value: list[~azure.mgmt.batch.models.BatchAccount] + :ivar next_link: The continuation token. + :vartype next_link: str """ _attribute_map = { @@ -943,6 +1114,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection of Batch accounts returned by the listing operation. + :paramtype value: list[~azure.mgmt.batch.models.BatchAccount] + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(BatchAccountListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -953,9 +1130,9 @@ class BatchAccountRegenerateKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_name: Required. The type of account key to regenerate. Possible values include: + :ivar key_name: Required. The type of account key to regenerate. Possible values include: "Primary", "Secondary". - :type key_name: str or ~azure.mgmt.batch.models.AccountKeyType + :vartype key_name: str or ~azure.mgmt.batch.models.AccountKeyType """ _validation = { @@ -972,6 +1149,11 @@ def __init__( key_name: Union[str, "AccountKeyType"], **kwargs ): + """ + :keyword key_name: Required. The type of account key to regenerate. Possible values include: + "Primary", "Secondary". + :paramtype key_name: str or ~azure.mgmt.batch.models.AccountKeyType + """ super(BatchAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -979,20 +1161,20 @@ def __init__( class BatchAccountUpdateParameters(msrest.serialization.Model): """Parameters for updating an Azure Batch account. - :param tags: A set of tags. The user-specified tags associated with the account. - :type tags: dict[str, str] - :param identity: The identity of the Batch account. - :type identity: ~azure.mgmt.batch.models.BatchAccountIdentity - :param auto_storage: The properties related to the auto-storage account. - :type auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties - :param encryption: Configures how customer data is encrypted inside the Batch account. By + :ivar tags: A set of tags. The user-specified tags associated with the account. + :vartype tags: dict[str, str] + :ivar identity: The identity of the Batch account. + :vartype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :ivar auto_storage: The properties related to the auto-storage account. + :vartype auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties + :ivar encryption: Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - :type encryption: ~azure.mgmt.batch.models.EncryptionProperties - :param allowed_authentication_modes: List of allowed authentication modes for the Batch account + :vartype encryption: ~azure.mgmt.batch.models.EncryptionProperties + :ivar allowed_authentication_modes: List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - :type allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] + :vartype allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] """ _attribute_map = { @@ -1013,6 +1195,23 @@ def __init__( allowed_authentication_modes: Optional[List[Union[str, "AuthenticationMode"]]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The user-specified tags associated with the account. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the Batch account. + :paramtype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :keyword auto_storage: The properties related to the auto-storage account. + :paramtype auto_storage: ~azure.mgmt.batch.models.AutoStorageBaseProperties + :keyword encryption: Configures how customer data is encrypted inside the Batch account. By + default, accounts are encrypted using a Microsoft managed key. For additional control, a + customer-managed key can be used instead. + :paramtype encryption: ~azure.mgmt.batch.models.EncryptionProperties + :keyword allowed_authentication_modes: List of allowed authentication modes for the Batch + account that can be used to authenticate with the data plane. This does not affect + authentication with the control plane. + :paramtype allowed_authentication_modes: list[str or + ~azure.mgmt.batch.models.AuthenticationMode] + """ super(BatchAccountUpdateParameters, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -1043,6 +1242,8 @@ def __init__( self, **kwargs ): + """ + """ super(BatchLocationQuota, self).__init__(**kwargs) self.account_quota = None @@ -1052,11 +1253,11 @@ class BatchPoolIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of identity used for the Batch Pool. Possible values include: + :ivar type: Required. The type of identity used for the Batch Pool. Possible values include: "UserAssigned", "None". - :type type: str or ~azure.mgmt.batch.models.PoolIdentityType - :param user_assigned_identities: The list of user identities associated with the Batch pool. - :type user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] + :vartype type: str or ~azure.mgmt.batch.models.PoolIdentityType + :ivar user_assigned_identities: The list of user identities associated with the Batch pool. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] """ _validation = { @@ -1075,6 +1276,13 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentities"]] = None, **kwargs ): + """ + :keyword type: Required. The type of identity used for the Batch Pool. Possible values include: + "UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.batch.models.PoolIdentityType + :keyword user_assigned_identities: The list of user identities associated with the Batch pool. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.batch.models.UserAssignedIdentities] + """ super(BatchPoolIdentity, self).__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities @@ -1093,15 +1301,15 @@ class Certificate(ProxyResource): :vartype type: str :ivar etag: The ETag of the resource, used for concurrency statements. :vartype etag: str - :param thumbprint_algorithm: This must match the first portion of the certificate name. + :ivar thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is + :vartype thumbprint_algorithm: str + :ivar thumbprint: This must match the thumbprint from the name. + :vartype thumbprint: str + :ivar format: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". + :vartype format: str or ~azure.mgmt.batch.models.CertificateFormat + :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.batch.models.CertificateProvisioningState :ivar provisioning_state_transition_time: The time at which the certificate entered its current state. @@ -1157,6 +1365,16 @@ def __init__( format: Optional[Union[str, "CertificateFormat"]] = None, **kwargs ): + """ + :keyword thumbprint_algorithm: This must match the first portion of the certificate name. + Currently required to be 'SHA1'. + :paramtype thumbprint_algorithm: str + :keyword thumbprint: This must match the thumbprint from the name. + :paramtype thumbprint: str + :keyword format: The format of the certificate - either Pfx or Cer. If omitted, the default is + Pfx. Possible values include: "Pfx", "Cer". + :paramtype format: str or ~azure.mgmt.batch.models.CertificateFormat + """ super(Certificate, self).__init__(**kwargs) self.thumbprint_algorithm = thumbprint_algorithm self.thumbprint = thumbprint @@ -1172,14 +1390,14 @@ def __init__( class CertificateBaseProperties(msrest.serialization.Model): """Base certificate properties. - :param thumbprint_algorithm: This must match the first portion of the certificate name. + :ivar thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is + :vartype thumbprint_algorithm: str + :ivar thumbprint: This must match the thumbprint from the name. + :vartype thumbprint: str + :ivar format: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat + :vartype format: str or ~azure.mgmt.batch.models.CertificateFormat """ _attribute_map = { @@ -1196,6 +1414,16 @@ def __init__( format: Optional[Union[str, "CertificateFormat"]] = None, **kwargs ): + """ + :keyword thumbprint_algorithm: This must match the first portion of the certificate name. + Currently required to be 'SHA1'. + :paramtype thumbprint_algorithm: str + :keyword thumbprint: This must match the thumbprint from the name. + :paramtype thumbprint: str + :keyword format: The format of the certificate - either Pfx or Cer. If omitted, the default is + Pfx. Possible values include: "Pfx", "Cer". + :paramtype format: str or ~azure.mgmt.batch.models.CertificateFormat + """ super(CertificateBaseProperties, self).__init__(**kwargs) self.thumbprint_algorithm = thumbprint_algorithm self.thumbprint = thumbprint @@ -1215,18 +1443,18 @@ class CertificateCreateOrUpdateParameters(ProxyResource): :vartype type: str :ivar etag: The ETag of the resource, used for concurrency statements. :vartype etag: str - :param thumbprint_algorithm: This must match the first portion of the certificate name. + :ivar thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is + :vartype thumbprint_algorithm: str + :ivar thumbprint: This must match the thumbprint from the name. + :vartype thumbprint: str + :ivar format: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :param data: The maximum size is 10KB. - :type data: str - :param password: This must not be specified if the certificate format is Cer. - :type password: str + :vartype format: str or ~azure.mgmt.batch.models.CertificateFormat + :ivar data: The maximum size is 10KB. + :vartype data: str + :ivar password: This must not be specified if the certificate format is Cer. + :vartype password: str """ _validation = { @@ -1258,6 +1486,20 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint_algorithm: This must match the first portion of the certificate name. + Currently required to be 'SHA1'. + :paramtype thumbprint_algorithm: str + :keyword thumbprint: This must match the thumbprint from the name. + :paramtype thumbprint: str + :keyword format: The format of the certificate - either Pfx or Cer. If omitted, the default is + Pfx. Possible values include: "Pfx", "Cer". + :paramtype format: str or ~azure.mgmt.batch.models.CertificateFormat + :keyword data: The maximum size is 10KB. + :paramtype data: str + :keyword password: This must not be specified if the certificate format is Cer. + :paramtype password: str + """ super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs) self.thumbprint_algorithm = thumbprint_algorithm self.thumbprint = thumbprint @@ -1271,18 +1513,18 @@ class CertificateCreateOrUpdateProperties(CertificateBaseProperties): All required parameters must be populated in order to send to Azure. - :param thumbprint_algorithm: This must match the first portion of the certificate name. + :ivar thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is + :vartype thumbprint_algorithm: str + :ivar thumbprint: This must match the thumbprint from the name. + :vartype thumbprint: str + :ivar format: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :param data: Required. The maximum size is 10KB. - :type data: str - :param password: This must not be specified if the certificate format is Cer. - :type password: str + :vartype format: str or ~azure.mgmt.batch.models.CertificateFormat + :ivar data: Required. The maximum size is 10KB. + :vartype data: str + :ivar password: This must not be specified if the certificate format is Cer. + :vartype password: str """ _validation = { @@ -1307,6 +1549,20 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint_algorithm: This must match the first portion of the certificate name. + Currently required to be 'SHA1'. + :paramtype thumbprint_algorithm: str + :keyword thumbprint: This must match the thumbprint from the name. + :paramtype thumbprint: str + :keyword format: The format of the certificate - either Pfx or Cer. If omitted, the default is + Pfx. Possible values include: "Pfx", "Cer". + :paramtype format: str or ~azure.mgmt.batch.models.CertificateFormat + :keyword data: Required. The maximum size is 10KB. + :paramtype data: str + :keyword password: This must not be specified if the certificate format is Cer. + :paramtype password: str + """ super(CertificateCreateOrUpdateProperties, self).__init__(thumbprint_algorithm=thumbprint_algorithm, thumbprint=thumbprint, format=format, **kwargs) self.data = data self.password = password @@ -1317,15 +1573,15 @@ class CertificateProperties(CertificateBaseProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint_algorithm: This must match the first portion of the certificate name. + :ivar thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. - :type thumbprint_algorithm: str - :param thumbprint: This must match the thumbprint from the name. - :type thumbprint: str - :param format: The format of the certificate - either Pfx or Cer. If omitted, the default is + :vartype thumbprint_algorithm: str + :ivar thumbprint: This must match the thumbprint from the name. + :vartype thumbprint: str + :ivar format: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: "Pfx", "Cer". - :type format: str or ~azure.mgmt.batch.models.CertificateFormat - :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". + :vartype format: str or ~azure.mgmt.batch.models.CertificateFormat + :ivar provisioning_state: Possible values include: "Succeeded", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.batch.models.CertificateProvisioningState :ivar provisioning_state_transition_time: The time at which the certificate entered its current state. @@ -1373,6 +1629,16 @@ def __init__( format: Optional[Union[str, "CertificateFormat"]] = None, **kwargs ): + """ + :keyword thumbprint_algorithm: This must match the first portion of the certificate name. + Currently required to be 'SHA1'. + :paramtype thumbprint_algorithm: str + :keyword thumbprint: This must match the thumbprint from the name. + :paramtype thumbprint: str + :keyword format: The format of the certificate - either Pfx or Cer. If omitted, the default is + Pfx. Possible values include: "Pfx", "Cer". + :paramtype format: str or ~azure.mgmt.batch.models.CertificateFormat + """ super(CertificateProperties, self).__init__(thumbprint_algorithm=thumbprint_algorithm, thumbprint=thumbprint, format=format, **kwargs) self.provisioning_state = None self.provisioning_state_transition_time = None @@ -1387,10 +1653,10 @@ class CertificateReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The fully qualified ID of the certificate to install on the pool. This - must be inside the same batch account as the pool. - :type id: str - :param store_location: The default value is currentUser. This property is applicable only for + :ivar id: Required. The fully qualified ID of the certificate to install on the pool. This must + be inside the same batch account as the pool. + :vartype id: str + :ivar store_location: The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment @@ -1398,16 +1664,16 @@ class CertificateReference(msrest.serialization.Model): certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: "CurrentUser", "LocalMachine". - :type store_location: str or ~azure.mgmt.batch.models.CertificateStoreLocation - :param store_name: This property is applicable only for pools configured with Windows nodes + :vartype store_location: str or ~azure.mgmt.batch.models.CertificateStoreLocation + :ivar store_name: This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. - :type store_name: str - :param visibility: Which user accounts on the compute node should have access to the private + :vartype store_name: str + :ivar visibility: Which user accounts on the compute node should have access to the private data of the certificate. - :type visibility: list[str or ~azure.mgmt.batch.models.CertificateVisibility] + :vartype visibility: list[str or ~azure.mgmt.batch.models.CertificateVisibility] """ _validation = { @@ -1430,6 +1696,29 @@ def __init__( visibility: Optional[List[Union[str, "CertificateVisibility"]]] = None, **kwargs ): + """ + :keyword id: Required. The fully qualified ID of the certificate to install on the pool. This + must be inside the same batch account as the pool. + :paramtype id: str + :keyword store_location: The default value is currentUser. This property is applicable only for + pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with + virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the + certificates are stored in a directory inside the task working directory and an environment + variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For + certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home + directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + Possible values include: "CurrentUser", "LocalMachine". + :paramtype store_location: str or ~azure.mgmt.batch.models.CertificateStoreLocation + :keyword store_name: This property is applicable only for pools configured with Windows nodes + (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a + Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, + TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be + used. The default value is My. + :paramtype store_name: str + :keyword visibility: Which user accounts on the compute node should have access to the private + data of the certificate. + :paramtype visibility: list[str or ~azure.mgmt.batch.models.CertificateVisibility] + """ super(CertificateReference, self).__init__(**kwargs) self.id = id self.store_location = store_location @@ -1444,8 +1733,8 @@ class CheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name to check for availability. - :type name: str + :ivar name: Required. The name to check for availability. + :vartype name: str :ivar type: The resource type. Has constant value: "Microsoft.Batch/batchAccounts". :vartype type: str """ @@ -1468,6 +1757,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name to check for availability. + :paramtype name: str + """ super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1505,6 +1798,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -1516,17 +1811,17 @@ class CIFSMountConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param username: Required. The user to use for authentication against the CIFS file system. - :type username: str - :param source: Required. The URI of the file system to mount. - :type source: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts + :ivar username: Required. The user to use for authentication against the CIFS file system. + :vartype username: str + :ivar source: Required. The URI of the file system to mount. + :vartype source: str + :ivar relative_mount_path: Required. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str - :param password: Required. The password to use for authentication against the CIFS file system. - :type password: str + :vartype relative_mount_path: str + :ivar mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :vartype mount_options: str + :ivar password: Required. The password to use for authentication against the CIFS file system. + :vartype password: str """ _validation = { @@ -1554,6 +1849,20 @@ def __init__( mount_options: Optional[str] = None, **kwargs ): + """ + :keyword username: Required. The user to use for authentication against the CIFS file system. + :paramtype username: str + :keyword source: Required. The URI of the file system to mount. + :paramtype source: str + :keyword relative_mount_path: Required. All file systems are mounted relative to the Batch + mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + :paramtype relative_mount_path: str + :keyword mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :paramtype mount_options: str + :keyword password: Required. The password to use for authentication against the CIFS file + system. + :paramtype password: str + """ super(CIFSMountConfiguration, self).__init__(**kwargs) self.username = username self.source = source @@ -1565,17 +1874,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Batch service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.batch.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.batch.models.CloudErrorBody] """ _attribute_map = { @@ -1594,6 +1903,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.batch.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1606,15 +1928,15 @@ class CloudServiceConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_family: Required. Possible values are: 2 - OS Family 2, equivalent to Windows Server + :ivar os_family: Required. Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). - :type os_family: str - :param os_version: The default value is * which specifies the latest operating system version + :vartype os_family: str + :ivar os_version: The default value is * which specifies the latest operating system version for the specified OS family. - :type os_version: str + :vartype os_version: str """ _validation = { @@ -1633,6 +1955,18 @@ def __init__( os_version: Optional[str] = None, **kwargs ): + """ + :keyword os_family: Required. Possible values are: 2 - OS Family 2, equivalent to Windows + Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, + equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - + OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS + Releases + (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + :paramtype os_family: str + :keyword os_version: The default value is * which specifies the latest operating system version + for the specified OS family. + :paramtype os_version: str + """ super(CloudServiceConfiguration, self).__init__(**kwargs) self.os_family = os_family self.os_version = os_version @@ -1641,8 +1975,8 @@ def __init__( class ComputeNodeIdentityReference(msrest.serialization.Model): """The reference to a user assigned identity associated with the Batch pool which a compute node will use. - :param resource_id: The ARM resource id of the user assigned identity. - :type resource_id: str + :ivar resource_id: The ARM resource id of the user assigned identity. + :vartype resource_id: str """ _attribute_map = { @@ -1655,6 +1989,10 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword resource_id: The ARM resource id of the user assigned identity. + :paramtype resource_id: str + """ super(ComputeNodeIdentityReference, self).__init__(**kwargs) self.resource_id = resource_id @@ -1668,13 +2006,13 @@ class ContainerConfiguration(msrest.serialization.Model): :ivar type: The container technology to be used. Has constant value: "DockerCompatible". :vartype type: str - :param container_image_names: This is the full image reference, as would be specified to - "docker pull". An image will be sourced from the default Docker registry unless the image is - fully qualified with an alternative registry. - :type container_image_names: list[str] - :param container_registries: If any images must be downloaded from a private registry which + :ivar container_image_names: This is the full image reference, as would be specified to "docker + pull". An image will be sourced from the default Docker registry unless the image is fully + qualified with an alternative registry. + :vartype container_image_names: list[str] + :ivar container_registries: If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. - :type container_registries: list[~azure.mgmt.batch.models.ContainerRegistry] + :vartype container_registries: list[~azure.mgmt.batch.models.ContainerRegistry] """ _validation = { @@ -1696,6 +2034,15 @@ def __init__( container_registries: Optional[List["ContainerRegistry"]] = None, **kwargs ): + """ + :keyword container_image_names: This is the full image reference, as would be specified to + "docker pull". An image will be sourced from the default Docker registry unless the image is + fully qualified with an alternative registry. + :paramtype container_image_names: list[str] + :keyword container_registries: If any images must be downloaded from a private registry which + requires credentials, then those credentials must be provided here. + :paramtype container_registries: list[~azure.mgmt.batch.models.ContainerRegistry] + """ super(ContainerConfiguration, self).__init__(**kwargs) self.container_image_names = container_image_names self.container_registries = container_registries @@ -1704,15 +2051,15 @@ def __init__( class ContainerRegistry(msrest.serialization.Model): """A private container registry. - :param user_name: The user name to log into the registry server. - :type user_name: str - :param password: The password to log into the registry server. - :type password: str - :param registry_server: If omitted, the default is "docker.io". - :type registry_server: str - :param identity_reference: The reference to a user assigned identity associated with the Batch + :ivar user_name: The user name to log into the registry server. + :vartype user_name: str + :ivar password: The password to log into the registry server. + :vartype password: str + :ivar registry_server: If omitted, the default is "docker.io". + :vartype registry_server: str + :ivar identity_reference: The reference to a user assigned identity associated with the Batch pool which a compute node will use. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :vartype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference """ _attribute_map = { @@ -1731,6 +2078,17 @@ def __init__( identity_reference: Optional["ComputeNodeIdentityReference"] = None, **kwargs ): + """ + :keyword user_name: The user name to log into the registry server. + :paramtype user_name: str + :keyword password: The password to log into the registry server. + :paramtype password: str + :keyword registry_server: If omitted, the default is "docker.io". + :paramtype registry_server: str + :keyword identity_reference: The reference to a user assigned identity associated with the + Batch pool which a compute node will use. + :paramtype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + """ super(ContainerRegistry, self).__init__(**kwargs) self.user_name = user_name self.password = password @@ -1743,10 +2101,10 @@ class DataDisk(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param lun: Required. The lun is used to uniquely identify each data disk. If attaching - multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. - :type lun: int - :param caching: Values are: + :ivar lun: Required. The lun is used to uniquely identify each data disk. If attaching multiple + disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. + :vartype lun: int + :ivar caching: Values are: none - The caching mode for the disk is not enabled. readOnly - The caching mode for the disk is read only. @@ -1755,15 +2113,15 @@ class DataDisk(msrest.serialization.Model): The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: "None", "ReadOnly", "ReadWrite". - :type caching: str or ~azure.mgmt.batch.models.CachingType - :param disk_size_gb: Required. The initial disk size in GB when creating new data disk. - :type disk_size_gb: int - :param storage_account_type: If omitted, the default is "Standard_LRS". Values are: + :vartype caching: str or ~azure.mgmt.batch.models.CachingType + :ivar disk_size_gb: Required. The initial disk size in GB when creating new data disk. + :vartype disk_size_gb: int + :ivar storage_account_type: If omitted, the default is "Standard_LRS". Values are: Standard_LRS - The data disk should use standard locally redundant storage. Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: "Standard_LRS", "Premium_LRS". - :type storage_account_type: str or ~azure.mgmt.batch.models.StorageAccountType + :vartype storage_account_type: str or ~azure.mgmt.batch.models.StorageAccountType """ _validation = { @@ -1787,6 +2145,29 @@ def __init__( storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, **kwargs ): + """ + :keyword lun: Required. The lun is used to uniquely identify each data disk. If attaching + multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. + :paramtype lun: int + :keyword caching: Values are: + + none - The caching mode for the disk is not enabled. + readOnly - The caching mode for the disk is read only. + readWrite - The caching mode for the disk is read and write. + + The default value for caching is none. For information about the caching options see: + https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.batch.models.CachingType + :keyword disk_size_gb: Required. The initial disk size in GB when creating new data disk. + :paramtype disk_size_gb: int + :keyword storage_account_type: If omitted, the default is "Standard_LRS". Values are: + + Standard_LRS - The data disk should use standard locally redundant storage. + Premium_LRS - The data disk should use premium locally redundant storage. Possible values + include: "Standard_LRS", "Premium_LRS". + :paramtype storage_account_type: str or ~azure.mgmt.batch.models.StorageAccountType + """ super(DataDisk, self).__init__(**kwargs) self.lun = lun self.caching = caching @@ -1799,17 +2180,17 @@ class DeleteCertificateError(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. An identifier for the error. Codes are invariant and are intended to be + :ivar code: Required. An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype code: str + :ivar message: Required. A message describing the error, intended to be suitable for display in + a user interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.batch.models.DeleteCertificateError] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.batch.models.DeleteCertificateError] """ _validation = { @@ -1833,6 +2214,19 @@ def __init__( details: Optional[List["DeleteCertificateError"]] = None, **kwargs ): + """ + :keyword code: Required. An identifier for the error. Codes are invariant and are intended to + be consumed programmatically. + :paramtype code: str + :keyword message: Required. A message describing the error, intended to be suitable for display + in a user interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.batch.models.DeleteCertificateError] + """ super(DeleteCertificateError, self).__init__(**kwargs) self.code = code self.message = message @@ -1843,13 +2237,13 @@ def __init__( class DeploymentConfiguration(msrest.serialization.Model): """Deployment configuration properties. - :param cloud_service_configuration: This property and virtualMachineConfiguration are mutually + :ivar cloud_service_configuration: This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. - :type cloud_service_configuration: ~azure.mgmt.batch.models.CloudServiceConfiguration - :param virtual_machine_configuration: This property and cloudServiceConfiguration are mutually + :vartype cloud_service_configuration: ~azure.mgmt.batch.models.CloudServiceConfiguration + :ivar virtual_machine_configuration: This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. - :type virtual_machine_configuration: ~azure.mgmt.batch.models.VirtualMachineConfiguration + :vartype virtual_machine_configuration: ~azure.mgmt.batch.models.VirtualMachineConfiguration """ _attribute_map = { @@ -1864,15 +2258,103 @@ def __init__( virtual_machine_configuration: Optional["VirtualMachineConfiguration"] = None, **kwargs ): + """ + :keyword cloud_service_configuration: This property and virtualMachineConfiguration are + mutually exclusive and one of the properties must be specified. This property cannot be + specified if the Batch account was created with its poolAllocationMode property set to + 'UserSubscription'. + :paramtype cloud_service_configuration: ~azure.mgmt.batch.models.CloudServiceConfiguration + :keyword virtual_machine_configuration: This property and cloudServiceConfiguration are + mutually exclusive and one of the properties must be specified. + :paramtype virtual_machine_configuration: ~azure.mgmt.batch.models.VirtualMachineConfiguration + """ super(DeploymentConfiguration, self).__init__(**kwargs) self.cloud_service_configuration = cloud_service_configuration self.virtual_machine_configuration = virtual_machine_configuration +class DetectorListResult(msrest.serialization.Model): + """Values returned by the List operation. + + :ivar value: The collection of Batch account detectors returned by the listing operation. + :vartype value: list[~azure.mgmt.batch.models.DetectorResponse] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DetectorResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DetectorResponse"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The collection of Batch account detectors returned by the listing operation. + :paramtype value: list[~azure.mgmt.batch.models.DetectorResponse] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ + super(DetectorListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DetectorResponse(ProxyResource): + """Contains the information for a detector. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: The ETag of the resource, used for concurrency statements. + :vartype etag: str + :ivar value: A base64 encoded string that represents the content of a detector. + :vartype value: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword value: A base64 encoded string that represents the content of a detector. + :paramtype value: str + """ + super(DetectorResponse, self).__init__(**kwargs) + self.value = value + + class DiffDiskSettings(msrest.serialization.Model): """Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. - :param placement: This property can be used by user in the request to choose which location the + :ivar placement: This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at @@ -1880,7 +2362,7 @@ class DiffDiskSettings(msrest.serialization.Model): and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. The only acceptable values to pass in are None and "CacheDisk". The default value is None. - :type placement: str + :vartype placement: str """ _attribute_map = { @@ -1893,6 +2375,17 @@ def __init__( placement: Optional[str] = None, **kwargs ): + """ + :keyword placement: This property can be used by user in the request to choose which location + the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. + For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk + size requirements for Windows VMs at + https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements + and Linux VMs at + https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. + The only acceptable values to pass in are None and "CacheDisk". The default value is None. + :paramtype placement: str + """ super(DiffDiskSettings, self).__init__(**kwargs) self.placement = placement @@ -1900,9 +2393,9 @@ def __init__( class DiskEncryptionConfiguration(msrest.serialization.Model): """The disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image. - :param targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and + :ivar targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. - :type targets: list[str or ~azure.mgmt.batch.models.DiskEncryptionTarget] + :vartype targets: list[str or ~azure.mgmt.batch.models.DiskEncryptionTarget] """ _attribute_map = { @@ -1915,6 +2408,11 @@ def __init__( targets: Optional[List[Union[str, "DiskEncryptionTarget"]]] = None, **kwargs ): + """ + :keyword targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" + and "TemporaryDisk" must be specified. + :paramtype targets: list[str or ~azure.mgmt.batch.models.DiskEncryptionTarget] + """ super(DiskEncryptionConfiguration, self).__init__(**kwargs) self.targets = targets @@ -1922,11 +2420,11 @@ def __init__( class EncryptionProperties(msrest.serialization.Model): """Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - :param key_source: Type of the key source. Possible values include: "Microsoft.Batch", + :ivar key_source: Type of the key source. Possible values include: "Microsoft.Batch", "Microsoft.KeyVault". - :type key_source: str or ~azure.mgmt.batch.models.KeySource - :param key_vault_properties: Additional details when using Microsoft.KeyVault. - :type key_vault_properties: ~azure.mgmt.batch.models.KeyVaultProperties + :vartype key_source: str or ~azure.mgmt.batch.models.KeySource + :ivar key_vault_properties: Additional details when using Microsoft.KeyVault. + :vartype key_vault_properties: ~azure.mgmt.batch.models.KeyVaultProperties """ _attribute_map = { @@ -1941,6 +2439,13 @@ def __init__( key_vault_properties: Optional["KeyVaultProperties"] = None, **kwargs ): + """ + :keyword key_source: Type of the key source. Possible values include: "Microsoft.Batch", + "Microsoft.KeyVault". + :paramtype key_source: str or ~azure.mgmt.batch.models.KeySource + :keyword key_vault_properties: Additional details when using Microsoft.KeyVault. + :paramtype key_vault_properties: ~azure.mgmt.batch.models.KeyVaultProperties + """ super(EncryptionProperties, self).__init__(**kwargs) self.key_source = key_source self.key_vault_properties = key_vault_properties @@ -1977,6 +2482,8 @@ def __init__( self, **kwargs ): + """ + """ super(EndpointDependency, self).__init__(**kwargs) self.domain_name = None self.description = None @@ -2004,6 +2511,8 @@ def __init__( self, **kwargs ): + """ + """ super(EndpointDetail, self).__init__(**kwargs) self.port = None @@ -2013,10 +2522,10 @@ class EnvironmentSetting(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the environment variable. - :type name: str - :param value: The value of the environment variable. - :type value: str + :ivar name: Required. The name of the environment variable. + :vartype name: str + :ivar value: The value of the environment variable. + :vartype value: str """ _validation = { @@ -2035,6 +2544,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The name of the environment variable. + :paramtype name: str + :keyword value: The value of the environment variable. + :paramtype value: str + """ super(EnvironmentSetting, self).__init__(**kwargs) self.name = name self.value = value @@ -2043,20 +2558,21 @@ def __init__( class FixedScaleSettings(msrest.serialization.Model): """Fixed scale settings for the pool. - :param resize_timeout: The default value is 15 minutes. Timeout values use ISO 8601 format. For + :ivar resize_timeout: The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - :type resize_timeout: ~datetime.timedelta - :param target_dedicated_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes + :vartype resize_timeout: ~datetime.timedelta + :ivar target_dedicated_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes must + be set. + :vartype target_dedicated_nodes: int + :ivar target_low_priority_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. - :type target_dedicated_nodes: int - :param target_low_priority_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes - must be set. - :type target_low_priority_nodes: int - :param node_deallocation_option: If omitted, the default value is Requeue. Possible values + :vartype target_low_priority_nodes: int + :ivar node_deallocation_option: If omitted, the default value is Requeue. Possible values include: "Requeue", "Terminate", "TaskCompletion", "RetainedData". - :type node_deallocation_option: str or ~azure.mgmt.batch.models.ComputeNodeDeallocationOption + :vartype node_deallocation_option: str or + ~azure.mgmt.batch.models.ComputeNodeDeallocationOption """ _attribute_map = { @@ -2075,6 +2591,23 @@ def __init__( node_deallocation_option: Optional[Union[str, "ComputeNodeDeallocationOption"]] = None, **kwargs ): + """ + :keyword resize_timeout: The default value is 15 minutes. Timeout values use ISO 8601 format. + For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value + less than 5 minutes, the Batch service rejects the request with an error; if you are calling + the REST API directly, the HTTP status code is 400 (Bad Request). + :paramtype resize_timeout: ~datetime.timedelta + :keyword target_dedicated_nodes: At least one of targetDedicatedNodes, targetLowPriorityNodes + must be set. + :paramtype target_dedicated_nodes: int + :keyword target_low_priority_nodes: At least one of targetDedicatedNodes, + targetLowPriorityNodes must be set. + :paramtype target_low_priority_nodes: int + :keyword node_deallocation_option: If omitted, the default value is Requeue. Possible values + include: "Requeue", "Terminate", "TaskCompletion", "RetainedData". + :paramtype node_deallocation_option: str or + ~azure.mgmt.batch.models.ComputeNodeDeallocationOption + """ super(FixedScaleSettings, self).__init__(**kwargs) self.resize_timeout = resize_timeout self.target_dedicated_nodes = target_dedicated_nodes @@ -2085,20 +2618,20 @@ def __init__( class ImageReference(msrest.serialization.Model): """A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. - :param publisher: For example, Canonical or MicrosoftWindowsServer. - :type publisher: str - :param offer: For example, UbuntuServer or WindowsServer. - :type offer: str - :param sku: For example, 18.04-LTS or 2019-Datacenter. - :type sku: str - :param version: A value of 'latest' can be specified to select the latest version of an image. + :ivar publisher: For example, Canonical or MicrosoftWindowsServer. + :vartype publisher: str + :ivar offer: For example, UbuntuServer or WindowsServer. + :vartype offer: str + :ivar sku: For example, 18.04-LTS or 2022-datacenter. + :vartype sku: str + :ivar version: A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. - :type version: str - :param id: This property is mutually exclusive with other properties. The Shared Image Gallery + :vartype version: str + :ivar id: This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - :type id: str + :vartype id: str """ _attribute_map = { @@ -2119,6 +2652,22 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword publisher: For example, Canonical or MicrosoftWindowsServer. + :paramtype publisher: str + :keyword offer: For example, UbuntuServer or WindowsServer. + :paramtype offer: str + :keyword sku: For example, 18.04-LTS or 2022-datacenter. + :paramtype sku: str + :keyword version: A value of 'latest' can be specified to select the latest version of an + image. If omitted, the default is 'latest'. + :paramtype version: str + :keyword id: This property is mutually exclusive with other properties. The Shared Image + Gallery image must have replicas in the same region as the Azure Batch account. For information + about the firewall settings for the Batch node agent to communicate with the Batch service see + https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + :paramtype id: str + """ super(ImageReference, self).__init__(**kwargs) self.publisher = publisher self.offer = offer @@ -2132,33 +2681,33 @@ class InboundNatPool(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name must be unique within a Batch pool, can contain letters, + :ivar name: Required. The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. - :type name: str - :param protocol: Required. The protocol of the endpoint. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.batch.models.InboundEndpointProtocol - :param backend_port: Required. This must be unique within a Batch pool. Acceptable values are + :vartype name: str + :ivar protocol: Required. The protocol of the endpoint. Possible values include: "TCP", "UDP". + :vartype protocol: str or ~azure.mgmt.batch.models.InboundEndpointProtocol + :ivar backend_port: Required. This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. - :type backend_port: int - :param frontend_port_range_start: Required. Acceptable values range between 1 and 65534 except + :vartype backend_port: int + :ivar frontend_port_range_start: Required. Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - :type frontend_port_range_start: int - :param frontend_port_range_end: Required. Acceptable values range between 1 and 65534 except + :vartype frontend_port_range_start: int + :ivar frontend_port_range_end: Required. Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - :type frontend_port_range_end: int - :param network_security_group_rules: The maximum number of rules that can be specified across + :vartype frontend_port_range_end: int + :ivar network_security_group_rules: The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. - :type network_security_group_rules: list[~azure.mgmt.batch.models.NetworkSecurityGroupRule] + :vartype network_security_group_rules: list[~azure.mgmt.batch.models.NetworkSecurityGroupRule] """ _validation = { @@ -2189,6 +2738,37 @@ def __init__( network_security_group_rules: Optional[List["NetworkSecurityGroupRule"]] = None, **kwargs ): + """ + :keyword name: Required. The name must be unique within a Batch pool, can contain letters, + numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end + with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values + are provided the request fails with HTTP status code 400. + :paramtype name: str + :keyword protocol: Required. The protocol of the endpoint. Possible values include: "TCP", + "UDP". + :paramtype protocol: str or ~azure.mgmt.batch.models.InboundEndpointProtocol + :keyword backend_port: Required. This must be unique within a Batch pool. Acceptable values are + between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved + values are provided the request fails with HTTP status code 400. + :paramtype backend_port: int + :keyword frontend_port_range_start: Required. Acceptable values range between 1 and 65534 + except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct + and cannot overlap. If any reserved or overlapping values are provided the request fails with + HTTP status code 400. + :paramtype frontend_port_range_start: int + :keyword frontend_port_range_end: Required. Acceptable values range between 1 and 65534 except + ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool + must be distinct and cannot overlap. If any reserved or overlapping values are provided the + request fails with HTTP status code 400. + :paramtype frontend_port_range_end: int + :keyword network_security_group_rules: The maximum number of rules that can be specified across + all the endpoints on a Batch pool is 25. If no network security group rules are specified, a + default rule will be created to allow inbound access to the specified backendPort. If the + maximum number of network security group rules is exceeded the request fails with HTTP status + code 400. + :paramtype network_security_group_rules: + list[~azure.mgmt.batch.models.NetworkSecurityGroupRule] + """ super(InboundNatPool, self).__init__(**kwargs) self.name = name self.protocol = protocol @@ -2201,14 +2781,14 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. - :param key_identifier: Full path to the versioned secret. Example + :ivar key_identifier: Full path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions The KeyVault has soft-delete and purge protection enabled. - :type key_identifier: str + :vartype key_identifier: str """ _attribute_map = { @@ -2221,6 +2801,16 @@ def __init__( key_identifier: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: Full path to the versioned secret. Example + https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable + the following prerequisites must be met: + + The Batch Account has a System Assigned identity + The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions + The KeyVault has soft-delete and purge protection enabled. + :paramtype key_identifier: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier @@ -2230,10 +2820,10 @@ class KeyVaultReference(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The resource ID of the Azure key vault associated with the Batch account. - :type id: str - :param url: Required. The URL of the Azure key vault associated with the Batch account. - :type url: str + :ivar id: Required. The resource ID of the Azure key vault associated with the Batch account. + :vartype id: str + :ivar url: Required. The URL of the Azure key vault associated with the Batch account. + :vartype url: str """ _validation = { @@ -2253,6 +2843,13 @@ def __init__( url: str, **kwargs ): + """ + :keyword id: Required. The resource ID of the Azure key vault associated with the Batch + account. + :paramtype id: str + :keyword url: Required. The URL of the Azure key vault associated with the Batch account. + :paramtype url: str + """ super(KeyVaultReference, self).__init__(**kwargs) self.id = id self.url = url @@ -2261,19 +2858,19 @@ def __init__( class LinuxUserConfiguration(msrest.serialization.Model): """Properties used to create a user account on a Linux node. - :param uid: The uid and gid properties must be specified together or not at all. If not + :ivar uid: The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. - :type uid: int - :param gid: The uid and gid properties must be specified together or not at all. If not + :vartype uid: int + :ivar gid: The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. - :type gid: int - :param ssh_private_key: The private key must not be password protected. The private key is used + :vartype gid: int + :ivar ssh_private_key: The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). - :type ssh_private_key: str + :vartype ssh_private_key: str """ _attribute_map = { @@ -2290,6 +2887,21 @@ def __init__( ssh_private_key: Optional[str] = None, **kwargs ): + """ + :keyword uid: The uid and gid properties must be specified together or not at all. If not + specified the underlying operating system picks the uid. + :paramtype uid: int + :keyword gid: The uid and gid properties must be specified together or not at all. If not + specified the underlying operating system picks the gid. + :paramtype gid: int + :keyword ssh_private_key: The private key must not be password protected. The private key is + used to automatically configure asymmetric-key based authentication for SSH between nodes in a + Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if + enableInterNodeCommunication is false). It does this by placing the key pair into the user's + .ssh directory. If not specified, password-less SSH is not configured between nodes (no + modification of the user's .ssh directory is done). + :paramtype ssh_private_key: str + """ super(LinuxUserConfiguration, self).__init__(**kwargs) self.uid = uid self.gid = gid @@ -2299,10 +2911,10 @@ def __init__( class ListApplicationPackagesResult(msrest.serialization.Model): """The result of performing list application packages. - :param value: The list of application packages. - :type value: list[~azure.mgmt.batch.models.ApplicationPackage] - :param next_link: The URL to get the next set of results. - :type next_link: str + :ivar value: The list of application packages. + :vartype value: list[~azure.mgmt.batch.models.ApplicationPackage] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -2317,6 +2929,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of application packages. + :paramtype value: list[~azure.mgmt.batch.models.ApplicationPackage] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ super(ListApplicationPackagesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2325,10 +2943,10 @@ def __init__( class ListApplicationsResult(msrest.serialization.Model): """The result of performing list applications. - :param value: The list of applications. - :type value: list[~azure.mgmt.batch.models.Application] - :param next_link: The URL to get the next set of results. - :type next_link: str + :ivar value: The list of applications. + :vartype value: list[~azure.mgmt.batch.models.Application] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -2343,6 +2961,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of applications. + :paramtype value: list[~azure.mgmt.batch.models.Application] + :keyword next_link: The URL to get the next set of results. + :paramtype next_link: str + """ super(ListApplicationsResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2351,10 +2975,10 @@ def __init__( class ListCertificatesResult(msrest.serialization.Model): """Values returned by the List operation. - :param value: The collection of returned certificates. - :type value: list[~azure.mgmt.batch.models.Certificate] - :param next_link: The continuation token. - :type next_link: str + :ivar value: The collection of returned certificates. + :vartype value: list[~azure.mgmt.batch.models.Certificate] + :ivar next_link: The continuation token. + :vartype next_link: str """ _attribute_map = { @@ -2369,6 +2993,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection of returned certificates. + :paramtype value: list[~azure.mgmt.batch.models.Certificate] + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(ListCertificatesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2377,10 +3007,10 @@ def __init__( class ListPoolsResult(msrest.serialization.Model): """Values returned by the List operation. - :param value: The collection of returned pools. - :type value: list[~azure.mgmt.batch.models.Pool] - :param next_link: The continuation token. - :type next_link: str + :ivar value: The collection of returned pools. + :vartype value: list[~azure.mgmt.batch.models.Pool] + :ivar next_link: The continuation token. + :vartype next_link: str """ _attribute_map = { @@ -2395,6 +3025,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection of returned pools. + :paramtype value: list[~azure.mgmt.batch.models.Pool] + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(ListPoolsResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2403,10 +3039,10 @@ def __init__( class ListPrivateEndpointConnectionsResult(msrest.serialization.Model): """Values returned by the List operation. - :param value: The collection of returned private endpoint connection. - :type value: list[~azure.mgmt.batch.models.PrivateEndpointConnection] - :param next_link: The continuation token. - :type next_link: str + :ivar value: The collection of returned private endpoint connection. + :vartype value: list[~azure.mgmt.batch.models.PrivateEndpointConnection] + :ivar next_link: The continuation token. + :vartype next_link: str """ _attribute_map = { @@ -2421,6 +3057,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection of returned private endpoint connection. + :paramtype value: list[~azure.mgmt.batch.models.PrivateEndpointConnection] + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(ListPrivateEndpointConnectionsResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2429,10 +3071,10 @@ def __init__( class ListPrivateLinkResourcesResult(msrest.serialization.Model): """Values returned by the List operation. - :param value: The collection of returned private link resources. - :type value: list[~azure.mgmt.batch.models.PrivateLinkResource] - :param next_link: The continuation token. - :type next_link: str + :ivar value: The collection of returned private link resources. + :vartype value: list[~azure.mgmt.batch.models.PrivateLinkResource] + :ivar next_link: The continuation token. + :vartype next_link: str """ _attribute_map = { @@ -2447,6 +3089,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The collection of returned private link resources. + :paramtype value: list[~azure.mgmt.batch.models.PrivateLinkResource] + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(ListPrivateLinkResourcesResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2457,10 +3105,10 @@ class MetadataItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the metadata item. - :type name: str - :param value: Required. The value of the metadata item. - :type value: str + :ivar name: Required. The name of the metadata item. + :vartype name: str + :ivar value: Required. The value of the metadata item. + :vartype value: str """ _validation = { @@ -2480,6 +3128,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The name of the metadata item. + :paramtype name: str + :keyword value: Required. The value of the metadata item. + :paramtype value: str + """ super(MetadataItem, self).__init__(**kwargs) self.name = name self.value = value @@ -2488,17 +3142,17 @@ def __init__( class MountConfiguration(msrest.serialization.Model): """The file system to mount on each node. - :param azure_blob_file_system_configuration: This property is mutually exclusive with all other + :ivar azure_blob_file_system_configuration: This property is mutually exclusive with all other properties. - :type azure_blob_file_system_configuration: + :vartype azure_blob_file_system_configuration: ~azure.mgmt.batch.models.AzureBlobFileSystemConfiguration - :param nfs_mount_configuration: This property is mutually exclusive with all other properties. - :type nfs_mount_configuration: ~azure.mgmt.batch.models.NFSMountConfiguration - :param cifs_mount_configuration: This property is mutually exclusive with all other properties. - :type cifs_mount_configuration: ~azure.mgmt.batch.models.CIFSMountConfiguration - :param azure_file_share_configuration: This property is mutually exclusive with all other + :ivar nfs_mount_configuration: This property is mutually exclusive with all other properties. + :vartype nfs_mount_configuration: ~azure.mgmt.batch.models.NFSMountConfiguration + :ivar cifs_mount_configuration: This property is mutually exclusive with all other properties. + :vartype cifs_mount_configuration: ~azure.mgmt.batch.models.CIFSMountConfiguration + :ivar azure_file_share_configuration: This property is mutually exclusive with all other properties. - :type azure_file_share_configuration: ~azure.mgmt.batch.models.AzureFileShareConfiguration + :vartype azure_file_share_configuration: ~azure.mgmt.batch.models.AzureFileShareConfiguration """ _attribute_map = { @@ -2517,6 +3171,21 @@ def __init__( azure_file_share_configuration: Optional["AzureFileShareConfiguration"] = None, **kwargs ): + """ + :keyword azure_blob_file_system_configuration: This property is mutually exclusive with all + other properties. + :paramtype azure_blob_file_system_configuration: + ~azure.mgmt.batch.models.AzureBlobFileSystemConfiguration + :keyword nfs_mount_configuration: This property is mutually exclusive with all other + properties. + :paramtype nfs_mount_configuration: ~azure.mgmt.batch.models.NFSMountConfiguration + :keyword cifs_mount_configuration: This property is mutually exclusive with all other + properties. + :paramtype cifs_mount_configuration: ~azure.mgmt.batch.models.CIFSMountConfiguration + :keyword azure_file_share_configuration: This property is mutually exclusive with all other + properties. + :paramtype azure_file_share_configuration: ~azure.mgmt.batch.models.AzureFileShareConfiguration + """ super(MountConfiguration, self).__init__(**kwargs) self.azure_blob_file_system_configuration = azure_blob_file_system_configuration self.nfs_mount_configuration = nfs_mount_configuration @@ -2527,7 +3196,7 @@ def __init__( class NetworkConfiguration(msrest.serialization.Model): """The network configuration for a pool. - :param subnet_id: The virtual network must be in the same region and subscription as the Azure + :ivar subnet_id: The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' @@ -2544,17 +3213,22 @@ class NetworkConfiguration(msrest.serialization.Model): connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - :type subnet_id: str - :param endpoint_configuration: Pool endpoint configuration is only supported on pools with the + :vartype subnet_id: str + :ivar dynamic_v_net_assignment_scope: The scope of dynamic vnet assignment. Possible values + include: "none", "job". + :vartype dynamic_v_net_assignment_scope: str or + ~azure.mgmt.batch.models.DynamicVNetAssignmentScope + :ivar endpoint_configuration: Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. - :type endpoint_configuration: ~azure.mgmt.batch.models.PoolEndpointConfiguration - :param public_ip_address_configuration: This property is only supported on Pools with the + :vartype endpoint_configuration: ~azure.mgmt.batch.models.PoolEndpointConfiguration + :ivar public_ip_address_configuration: This property is only supported on Pools with the virtualMachineConfiguration property. - :type public_ip_address_configuration: ~azure.mgmt.batch.models.PublicIPAddressConfiguration + :vartype public_ip_address_configuration: ~azure.mgmt.batch.models.PublicIPAddressConfiguration """ _attribute_map = { 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'dynamic_v_net_assignment_scope': {'key': 'dynamicVNetAssignmentScope', 'type': 'str'}, 'endpoint_configuration': {'key': 'endpointConfiguration', 'type': 'PoolEndpointConfiguration'}, 'public_ip_address_configuration': {'key': 'publicIPAddressConfiguration', 'type': 'PublicIPAddressConfiguration'}, } @@ -2563,12 +3237,45 @@ def __init__( self, *, subnet_id: Optional[str] = None, + dynamic_v_net_assignment_scope: Optional[Union[str, "DynamicVNetAssignmentScope"]] = None, endpoint_configuration: Optional["PoolEndpointConfiguration"] = None, public_ip_address_configuration: Optional["PublicIPAddressConfiguration"] = None, **kwargs ): + """ + :keyword subnet_id: The virtual network must be in the same region and subscription as the + Azure Batch account. The specified subnet should have enough free IP addresses to accommodate + the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool + will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' + service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control + (RBAC) role for the specified VNet. The specified subnet must allow communication from the + Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by + checking if the specified VNet has any associated Network Security Groups (NSG). If + communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch + service will set the state of the compute nodes to unusable. If the specified VNet has any + associated Network Security Groups (NSG), then a few reserved system ports must be enabled for + inbound communication. For pools created with a virtual machine configuration, enable ports + 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with + a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound + connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' + VNETs are supported. For more details see: + https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + :paramtype subnet_id: str + :keyword dynamic_v_net_assignment_scope: The scope of dynamic vnet assignment. Possible values + include: "none", "job". + :paramtype dynamic_v_net_assignment_scope: str or + ~azure.mgmt.batch.models.DynamicVNetAssignmentScope + :keyword endpoint_configuration: Pool endpoint configuration is only supported on pools with + the virtualMachineConfiguration property. + :paramtype endpoint_configuration: ~azure.mgmt.batch.models.PoolEndpointConfiguration + :keyword public_ip_address_configuration: This property is only supported on Pools with the + virtualMachineConfiguration property. + :paramtype public_ip_address_configuration: + ~azure.mgmt.batch.models.PublicIPAddressConfiguration + """ super(NetworkConfiguration, self).__init__(**kwargs) self.subnet_id = subnet_id + self.dynamic_v_net_assignment_scope = dynamic_v_net_assignment_scope self.endpoint_configuration = endpoint_configuration self.public_ip_address_configuration = public_ip_address_configuration @@ -2578,24 +3285,24 @@ class NetworkSecurityGroupRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param priority: Required. Priorities within a pool must be unique and are evaluated in order - of priority. The lower the number the higher the priority. For example, rules could be - specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes - precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any - reserved or duplicate values are provided the request fails with HTTP status code 400. - :type priority: int - :param access: Required. The action that should be taken for a specified IP address, subnet + :ivar priority: Required. Priorities within a pool must be unique and are evaluated in order of + priority. The lower the number the higher the priority. For example, rules could be specified + with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence + over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or + duplicate values are provided the request fails with HTTP status code 400. + :vartype priority: int + :ivar access: Required. The action that should be taken for a specified IP address, subnet range or tag. Possible values include: "Allow", "Deny". - :type access: str or ~azure.mgmt.batch.models.NetworkSecurityGroupRuleAccess - :param source_address_prefix: Required. Valid values are a single IP address (i.e. - 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any - other values are provided the request fails with HTTP status code 400. - :type source_address_prefix: str - :param source_port_ranges: Valid values are '\ *' (for all ports 0 - 65535) or arrays of ports + :vartype access: str or ~azure.mgmt.batch.models.NetworkSecurityGroupRuleAccess + :ivar source_address_prefix: Required. Valid values are a single IP address (i.e. 10.10.10.10), + IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values + are provided the request fails with HTTP status code 400. + :vartype source_address_prefix: str + :ivar source_port_ranges: Valid values are '\ *' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. - :type source_port_ranges: list[str] + :vartype source_port_ranges: list[str] """ _validation = { @@ -2620,6 +3327,26 @@ def __init__( source_port_ranges: Optional[List[str]] = None, **kwargs ): + """ + :keyword priority: Required. Priorities within a pool must be unique and are evaluated in order + of priority. The lower the number the higher the priority. For example, rules could be + specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes + precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any + reserved or duplicate values are provided the request fails with HTTP status code 400. + :paramtype priority: int + :keyword access: Required. The action that should be taken for a specified IP address, subnet + range or tag. Possible values include: "Allow", "Deny". + :paramtype access: str or ~azure.mgmt.batch.models.NetworkSecurityGroupRuleAccess + :keyword source_address_prefix: Required. Valid values are a single IP address (i.e. + 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any + other values are provided the request fails with HTTP status code 400. + :paramtype source_address_prefix: str + :keyword source_port_ranges: Valid values are '\ *' (for all ports 0 - 65535) or arrays of + ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port + ranges or ports can't overlap. If any other values are provided the request fails with HTTP + status code 400. Default value will be *. + :paramtype source_port_ranges: list[str] + """ super(NetworkSecurityGroupRule, self).__init__(**kwargs) self.priority = priority self.access = access @@ -2632,13 +3359,13 @@ class NFSMountConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source: Required. The URI of the file system to mount. - :type source: str - :param relative_mount_path: Required. All file systems are mounted relative to the Batch mounts + :ivar source: Required. The URI of the file system to mount. + :vartype source: str + :ivar relative_mount_path: Required. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - :type relative_mount_path: str - :param mount_options: These are 'net use' options in Windows and 'mount' options in Linux. - :type mount_options: str + :vartype relative_mount_path: str + :ivar mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :vartype mount_options: str """ _validation = { @@ -2660,6 +3387,15 @@ def __init__( mount_options: Optional[str] = None, **kwargs ): + """ + :keyword source: Required. The URI of the file system to mount. + :paramtype source: str + :keyword relative_mount_path: Required. All file systems are mounted relative to the Batch + mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + :paramtype relative_mount_path: str + :keyword mount_options: These are 'net use' options in Windows and 'mount' options in Linux. + :paramtype mount_options: str + """ super(NFSMountConfiguration, self).__init__(**kwargs) self.source = source self.relative_mount_path = relative_mount_path @@ -2669,9 +3405,9 @@ def __init__( class NodePlacementConfiguration(msrest.serialization.Model): """Allocation configuration used by Batch Service to provision the nodes. - :param policy: Allocation policy used by Batch Service to provision the nodes. If not - specified, Batch will use the regional policy. Possible values include: "Regional", "Zonal". - :type policy: str or ~azure.mgmt.batch.models.NodePlacementPolicyType + :ivar policy: Allocation policy used by Batch Service to provision the nodes. If not specified, + Batch will use the regional policy. Possible values include: "Regional", "Zonal". + :vartype policy: str or ~azure.mgmt.batch.models.NodePlacementPolicyType """ _attribute_map = { @@ -2684,6 +3420,11 @@ def __init__( policy: Optional[Union[str, "NodePlacementPolicyType"]] = None, **kwargs ): + """ + :keyword policy: Allocation policy used by Batch Service to provision the nodes. If not + specified, Batch will use the regional policy. Possible values include: "Regional", "Zonal". + :paramtype policy: str or ~azure.mgmt.batch.models.NodePlacementPolicyType + """ super(NodePlacementConfiguration, self).__init__(**kwargs) self.policy = policy @@ -2691,16 +3432,16 @@ def __init__( class Operation(msrest.serialization.Model): """A REST API operation. - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that describes the operation. - :type display: ~azure.mgmt.batch.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any + :ivar name: This is of the format {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.batch.models.OperationDisplay + :ivar origin: The intended executor of the operation. + :vartype origin: str + :ivar properties: Any object. + :vartype properties: any """ _attribute_map = { @@ -2721,6 +3462,18 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: This is of the format {provider}/{resource}/{operation}. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.batch.models.OperationDisplay + :keyword origin: The intended executor of the operation. + :paramtype origin: str + :keyword properties: Any object. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -2732,14 +3485,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete, or listKeys/action. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar operation: For example: read, write, delete, or listKeys/action. + :vartype operation: str + :ivar resource: The resource type on which the operation is performed. + :vartype resource: str + :ivar description: The friendly name of the operation. + :vartype description: str """ _attribute_map = { @@ -2758,6 +3511,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword operation: For example: read, write, delete, or listKeys/action. + :paramtype operation: str + :keyword resource: The resource type on which the operation is performed. + :paramtype resource: str + :keyword description: The friendly name of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.operation = operation @@ -2768,10 +3531,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - :param value: The list of operations supported by the resource provider. - :type value: list[~azure.mgmt.batch.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: The list of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.batch.models.Operation] + :ivar next_link: The URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -2786,6 +3549,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.batch.models.Operation] + :keyword next_link: The URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2794,9 +3563,9 @@ def __init__( class OSDisk(msrest.serialization.Model): """Settings for the operating system disk of the virtual machine. - :param ephemeral_os_disk_settings: Specifies the ephemeral Disk Settings for the operating + :ivar ephemeral_os_disk_settings: Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. - :type ephemeral_os_disk_settings: ~azure.mgmt.batch.models.DiffDiskSettings + :vartype ephemeral_os_disk_settings: ~azure.mgmt.batch.models.DiffDiskSettings """ _attribute_map = { @@ -2809,6 +3578,11 @@ def __init__( ephemeral_os_disk_settings: Optional["DiffDiskSettings"] = None, **kwargs ): + """ + :keyword ephemeral_os_disk_settings: Specifies the ephemeral Disk Settings for the operating + system disk used by the virtual machine. + :paramtype ephemeral_os_disk_settings: ~azure.mgmt.batch.models.DiffDiskSettings + """ super(OSDisk, self).__init__(**kwargs) self.ephemeral_os_disk_settings = ephemeral_os_disk_settings @@ -2839,6 +3613,8 @@ def __init__( self, **kwargs ): + """ + """ super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) self.category = None self.endpoints = None @@ -2852,8 +3628,8 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): :ivar value: The collection of outbound network dependency endpoints returned by the listing operation. :vartype value: list[~azure.mgmt.batch.models.OutboundEnvironmentEndpoint] - :param next_link: The continuation token. - :type next_link: str + :ivar next_link: The continuation token. + :vartype next_link: str """ _validation = { @@ -2871,6 +3647,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The continuation token. + :paramtype next_link: str + """ super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2889,11 +3669,11 @@ class Pool(ProxyResource): :vartype type: str :ivar etag: The ETag of the resource, used for concurrency statements. :vartype etag: str - :param identity: The type of identity used for the Batch Pool. - :type identity: ~azure.mgmt.batch.models.BatchPoolIdentity - :param display_name: The display name need not be unique and can contain any Unicode characters + :ivar identity: The type of identity used for the Batch Pool. + :vartype identity: ~azure.mgmt.batch.models.BatchPoolIdentity + :ivar display_name: The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - :type display_name: str + :vartype display_name: str :ivar last_modified: This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. @@ -2911,7 +3691,7 @@ class Pool(ProxyResource): :ivar allocation_state_transition_time: The time at which the pool entered its current allocation state. :vartype allocation_state_transition_time: ~datetime.datetime - :param vm_size: For information about available sizes of virtual machines for Cloud Services + :ivar vm_size: For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM @@ -2922,66 +3702,66 @@ class Pool(ProxyResource): (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). - :type vm_size: str - :param deployment_configuration: Using CloudServiceConfiguration specifies that the nodes - should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses - Azure Virtual Machines (IaaS). - :type deployment_configuration: ~azure.mgmt.batch.models.DeploymentConfiguration + :vartype vm_size: str + :ivar deployment_configuration: Using CloudServiceConfiguration specifies that the nodes should + be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure + Virtual Machines (IaaS). + :vartype deployment_configuration: ~azure.mgmt.batch.models.DeploymentConfiguration :ivar current_dedicated_nodes: The number of compute nodes currently in the pool. :vartype current_dedicated_nodes: int - :ivar current_low_priority_nodes: The number of low-priority compute nodes currently in the - pool. + :ivar current_low_priority_nodes: The number of Spot/low-priority compute nodes currently in + the pool. :vartype current_low_priority_nodes: int - :param scale_settings: Defines the desired size of the pool. This can either be 'fixedScale' + :ivar scale_settings: Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. - :type scale_settings: ~azure.mgmt.batch.models.ScaleSettings + :vartype scale_settings: ~azure.mgmt.batch.models.ScaleSettings :ivar auto_scale_run: This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. :vartype auto_scale_run: ~azure.mgmt.batch.models.AutoScaleRun - :param inter_node_communication: This imposes restrictions on which nodes can be assigned to - the pool. Enabling this value can reduce the chance of the requested number of nodes to be + :ivar inter_node_communication: This imposes restrictions on which nodes can be assigned to the + pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: "Enabled", "Disabled". - :type inter_node_communication: str or ~azure.mgmt.batch.models.InterNodeCommunicationState - :param network_configuration: The network configuration for a pool. - :type network_configuration: ~azure.mgmt.batch.models.NetworkConfiguration - :param task_slots_per_node: The default value is 1. The maximum value is the smaller of 4 times + :vartype inter_node_communication: str or ~azure.mgmt.batch.models.InterNodeCommunicationState + :ivar network_configuration: The network configuration for a pool. + :vartype network_configuration: ~azure.mgmt.batch.models.NetworkConfiguration + :ivar task_slots_per_node: The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. - :type task_slots_per_node: int - :param task_scheduling_policy: If not specified, the default is spread. - :type task_scheduling_policy: ~azure.mgmt.batch.models.TaskSchedulingPolicy - :param user_accounts: The list of user accounts to be created on each node in the pool. - :type user_accounts: list[~azure.mgmt.batch.models.UserAccount] - :param metadata: The Batch service does not assign any meaning to metadata; it is solely for - the use of user code. - :type metadata: list[~azure.mgmt.batch.models.MetadataItem] - :param start_task: In an PATCH (update) operation, this property can be set to an empty object + :vartype task_slots_per_node: int + :ivar task_scheduling_policy: If not specified, the default is spread. + :vartype task_scheduling_policy: ~azure.mgmt.batch.models.TaskSchedulingPolicy + :ivar user_accounts: The list of user accounts to be created on each node in the pool. + :vartype user_accounts: list[~azure.mgmt.batch.models.UserAccount] + :ivar metadata: The Batch service does not assign any meaning to metadata; it is solely for the + use of user code. + :vartype metadata: list[~azure.mgmt.batch.models.MetadataItem] + :ivar start_task: In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. - :type start_task: ~azure.mgmt.batch.models.StartTask - :param certificates: For Windows compute nodes, the Batch service installs the certificates to + :vartype start_task: ~azure.mgmt.batch.models.StartTask + :ivar certificates: For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. - :type certificates: list[~azure.mgmt.batch.models.CertificateReference] - :param application_packages: Changes to application package references affect all new compute + :vartype certificates: list[~azure.mgmt.batch.models.CertificateReference] + :ivar application_packages: Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. There is a maximum of 10 application package references on any given pool. - :type application_packages: list[~azure.mgmt.batch.models.ApplicationPackageReference] - :param application_licenses: The list of application licenses must be a subset of available + :vartype application_packages: list[~azure.mgmt.batch.models.ApplicationPackageReference] + :ivar application_licenses: The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. - :type application_licenses: list[str] + :vartype application_licenses: list[str] :ivar resize_operation_status: Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed operation (if the AllocationState is Steady). :vartype resize_operation_status: ~azure.mgmt.batch.models.ResizeOperationStatus - :param mount_configuration: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. - :type mount_configuration: list[~azure.mgmt.batch.models.MountConfiguration] + :ivar mount_configuration: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + :vartype mount_configuration: list[~azure.mgmt.batch.models.MountConfiguration] """ _validation = { @@ -3055,6 +3835,73 @@ def __init__( mount_configuration: Optional[List["MountConfiguration"]] = None, **kwargs ): + """ + :keyword identity: The type of identity used for the Batch Pool. + :paramtype identity: ~azure.mgmt.batch.models.BatchPoolIdentity + :keyword display_name: The display name need not be unique and can contain any Unicode + characters up to a maximum length of 1024. + :paramtype display_name: str + :keyword vm_size: For information about available sizes of virtual machines for Cloud Services + pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch + supports all Cloud Services VM sizes except ExtraSmall. For information about available VM + sizes for pools using images from the Virtual Machines Marketplace (pools created with + virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for + Virtual Machines (Windows) + (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch + supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, + STANDARD_DS, and STANDARD_DSV2 series). + :paramtype vm_size: str + :keyword deployment_configuration: Using CloudServiceConfiguration specifies that the nodes + should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses + Azure Virtual Machines (IaaS). + :paramtype deployment_configuration: ~azure.mgmt.batch.models.DeploymentConfiguration + :keyword scale_settings: Defines the desired size of the pool. This can either be 'fixedScale' + where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula + which is periodically reevaluated. If this property is not specified, the pool will have a + fixed scale with 0 targetDedicatedNodes. + :paramtype scale_settings: ~azure.mgmt.batch.models.ScaleSettings + :keyword inter_node_communication: This imposes restrictions on which nodes can be assigned to + the pool. Enabling this value can reduce the chance of the requested number of nodes to be + allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values + include: "Enabled", "Disabled". + :paramtype inter_node_communication: str or + ~azure.mgmt.batch.models.InterNodeCommunicationState + :keyword network_configuration: The network configuration for a pool. + :paramtype network_configuration: ~azure.mgmt.batch.models.NetworkConfiguration + :keyword task_slots_per_node: The default value is 1. The maximum value is the smaller of 4 + times the number of cores of the vmSize of the pool or 256. + :paramtype task_slots_per_node: int + :keyword task_scheduling_policy: If not specified, the default is spread. + :paramtype task_scheduling_policy: ~azure.mgmt.batch.models.TaskSchedulingPolicy + :keyword user_accounts: The list of user accounts to be created on each node in the pool. + :paramtype user_accounts: list[~azure.mgmt.batch.models.UserAccount] + :keyword metadata: The Batch service does not assign any meaning to metadata; it is solely for + the use of user code. + :paramtype metadata: list[~azure.mgmt.batch.models.MetadataItem] + :keyword start_task: In an PATCH (update) operation, this property can be set to an empty + object to remove the start task from the pool. + :paramtype start_task: ~azure.mgmt.batch.models.StartTask + :keyword certificates: For Windows compute nodes, the Batch service installs the certificates + to the specified certificate store and location. For Linux compute nodes, the certificates are + stored in a directory inside the task working directory and an environment variable + AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates + with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory + (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + :paramtype certificates: list[~azure.mgmt.batch.models.CertificateReference] + :keyword application_packages: Changes to application package references affect all new compute + nodes joining the pool, but do not affect compute nodes that are already in the pool until they + are rebooted or reimaged. There is a maximum of 10 application package references on any given + pool. + :paramtype application_packages: list[~azure.mgmt.batch.models.ApplicationPackageReference] + :keyword application_licenses: The list of application licenses must be a subset of available + Batch service application licenses. If a license is requested which is not supported, pool + creation will fail. + :paramtype application_licenses: list[str] + :keyword mount_configuration: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + :paramtype mount_configuration: list[~azure.mgmt.batch.models.MountConfiguration] + """ super(Pool, self).__init__(**kwargs) self.identity = identity self.display_name = display_name @@ -3089,10 +3936,10 @@ class PoolEndpointConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param inbound_nat_pools: Required. The maximum number of inbound NAT pools per Batch pool is - 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status - code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. - :type inbound_nat_pools: list[~azure.mgmt.batch.models.InboundNatPool] + :ivar inbound_nat_pools: Required. The maximum number of inbound NAT pools per Batch pool is 5. + If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code + 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. + :vartype inbound_nat_pools: list[~azure.mgmt.batch.models.InboundNatPool] """ _validation = { @@ -3109,6 +3956,12 @@ def __init__( inbound_nat_pools: List["InboundNatPool"], **kwargs ): + """ + :keyword inbound_nat_pools: Required. The maximum number of inbound NAT pools per Batch pool is + 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status + code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. + :paramtype inbound_nat_pools: list[~azure.mgmt.batch.models.InboundNatPool] + """ super(PoolEndpointConfiguration, self).__init__(**kwargs) self.inbound_nat_pools = inbound_nat_pools @@ -3135,6 +3988,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3156,11 +4011,11 @@ class PrivateEndpointConnection(ProxyResource): values include: "Succeeded", "Updating", "Failed". :vartype provisioning_state: str or ~azure.mgmt.batch.models.PrivateEndpointConnectionProvisioningState - :param private_endpoint: The private endpoint of the private endpoint connection. - :type private_endpoint: ~azure.mgmt.batch.models.PrivateEndpoint - :param private_link_service_connection_state: The private link service connection state of the + :ivar private_endpoint: The private endpoint of the private endpoint connection. + :vartype private_endpoint: ~azure.mgmt.batch.models.PrivateEndpoint + :ivar private_link_service_connection_state: The private link service connection state of the private endpoint connection. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~azure.mgmt.batch.models.PrivateLinkServiceConnectionState """ @@ -3189,6 +4044,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The private endpoint of the private endpoint connection. + :paramtype private_endpoint: ~azure.mgmt.batch.models.PrivateEndpoint + :keyword private_link_service_connection_state: The private link service connection state of + the private endpoint connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.batch.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.provisioning_state = None self.private_endpoint = private_endpoint @@ -3241,6 +4104,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -3254,11 +4119,11 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of the Batch private endpoint connection. Possible values + :ivar status: Required. The status of the Batch private endpoint connection. Possible values include: "Approved", "Pending", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.batch.models.PrivateLinkServiceConnectionStatus - :param description: Description of the private Connection state. - :type description: str + :vartype status: str or ~azure.mgmt.batch.models.PrivateLinkServiceConnectionStatus + :ivar description: Description of the private Connection state. + :vartype description: str :ivar action_required: Action required on the private connection state. :vartype action_required: str """ @@ -3281,6 +4146,13 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. The status of the Batch private endpoint connection. Possible values + include: "Approved", "Pending", "Rejected", "Disconnected". + :paramtype status: str or ~azure.mgmt.batch.models.PrivateLinkServiceConnectionStatus + :keyword description: Description of the private Connection state. + :paramtype description: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -3290,15 +4162,15 @@ def __init__( class PublicIPAddressConfiguration(msrest.serialization.Model): """The public IP Address configuration of the networking configuration of a Pool. - :param provision: The default value is BatchManaged. Possible values include: "BatchManaged", + :ivar provision: The default value is BatchManaged. Possible values include: "BatchManaged", "UserManaged", "NoPublicIPAddresses". - :type provision: str or ~azure.mgmt.batch.models.IPAddressProvisioningType - :param ip_address_ids: The number of IPs specified here limits the maximum size of the Pool - - 100 dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, - a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of - this collection is of the form: + :vartype provision: str or ~azure.mgmt.batch.models.IPAddressProvisioningType + :ivar ip_address_ids: The number of IPs specified here limits the maximum size of the Pool - + 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For + example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each + element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. - :type ip_address_ids: list[str] + :vartype ip_address_ids: list[str] """ _attribute_map = { @@ -3313,6 +4185,17 @@ def __init__( ip_address_ids: Optional[List[str]] = None, **kwargs ): + """ + :keyword provision: The default value is BatchManaged. Possible values include: "BatchManaged", + "UserManaged", "NoPublicIPAddresses". + :paramtype provision: str or ~azure.mgmt.batch.models.IPAddressProvisioningType + :keyword ip_address_ids: The number of IPs specified here limits the maximum size of the Pool - + 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For + example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each + element of this collection is of the form: + /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + :paramtype ip_address_ids: list[str] + """ super(PublicIPAddressConfiguration, self).__init__(**kwargs) self.provision = provision self.ip_address_ids = ip_address_ids @@ -3323,14 +4206,14 @@ class ResizeError(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. An identifier for the error. Codes are invariant and are intended to be + :ivar code: Required. An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: Required. A message describing the error, intended to be suitable for display - in a user interface. - :type message: str - :param details: Additional details about the error. - :type details: list[~azure.mgmt.batch.models.ResizeError] + :vartype code: str + :ivar message: Required. A message describing the error, intended to be suitable for display in + a user interface. + :vartype message: str + :ivar details: Additional details about the error. + :vartype details: list[~azure.mgmt.batch.models.ResizeError] """ _validation = { @@ -3352,6 +4235,16 @@ def __init__( details: Optional[List["ResizeError"]] = None, **kwargs ): + """ + :keyword code: Required. An identifier for the error. Codes are invariant and are intended to + be consumed programmatically. + :paramtype code: str + :keyword message: Required. A message describing the error, intended to be suitable for display + in a user interface. + :paramtype message: str + :keyword details: Additional details about the error. + :paramtype details: list[~azure.mgmt.batch.models.ResizeError] + """ super(ResizeError, self).__init__(**kwargs) self.code = code self.message = message @@ -3361,22 +4254,24 @@ def __init__( class ResizeOperationStatus(msrest.serialization.Model): """Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed operation (if the AllocationState is Steady). - :param target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. - :type target_dedicated_nodes: int - :param target_low_priority_nodes: The desired number of low-priority compute nodes in the pool. - :type target_low_priority_nodes: int - :param resize_timeout: The default value is 15 minutes. The minimum value is 5 minutes. If you + :ivar target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. + :vartype target_dedicated_nodes: int + :ivar target_low_priority_nodes: The desired number of Spot/low-priority compute nodes in the + pool. + :vartype target_low_priority_nodes: int + :ivar resize_timeout: The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - :type resize_timeout: ~datetime.timedelta - :param node_deallocation_option: The default value is requeue. Possible values include: + :vartype resize_timeout: ~datetime.timedelta + :ivar node_deallocation_option: The default value is requeue. Possible values include: "Requeue", "Terminate", "TaskCompletion", "RetainedData". - :type node_deallocation_option: str or ~azure.mgmt.batch.models.ComputeNodeDeallocationOption - :param start_time: The time when this resize operation was started. - :type start_time: ~datetime.datetime - :param errors: This property is set only if an error occurred during the last pool resize, and + :vartype node_deallocation_option: str or + ~azure.mgmt.batch.models.ComputeNodeDeallocationOption + :ivar start_time: The time when this resize operation was started. + :vartype start_time: ~datetime.datetime + :ivar errors: This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. - :type errors: list[~azure.mgmt.batch.models.ResizeError] + :vartype errors: list[~azure.mgmt.batch.models.ResizeError] """ _attribute_map = { @@ -3399,6 +4294,26 @@ def __init__( errors: Optional[List["ResizeError"]] = None, **kwargs ): + """ + :keyword target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. + :paramtype target_dedicated_nodes: int + :keyword target_low_priority_nodes: The desired number of Spot/low-priority compute nodes in + the pool. + :paramtype target_low_priority_nodes: int + :keyword resize_timeout: The default value is 15 minutes. The minimum value is 5 minutes. If + you specify a value less than 5 minutes, the Batch service returns an error; if you are calling + the REST API directly, the HTTP status code is 400 (Bad Request). + :paramtype resize_timeout: ~datetime.timedelta + :keyword node_deallocation_option: The default value is requeue. Possible values include: + "Requeue", "Terminate", "TaskCompletion", "RetainedData". + :paramtype node_deallocation_option: str or + ~azure.mgmt.batch.models.ComputeNodeDeallocationOption + :keyword start_time: The time when this resize operation was started. + :paramtype start_time: ~datetime.datetime + :keyword errors: This property is set only if an error occurred during the last pool resize, + and only when the pool allocationState is Steady. + :paramtype errors: list[~azure.mgmt.batch.models.ResizeError] + """ super(ResizeOperationStatus, self).__init__(**kwargs) self.target_dedicated_nodes = target_dedicated_nodes self.target_low_priority_nodes = target_low_priority_nodes @@ -3411,43 +4326,43 @@ def __init__( class ResourceFile(msrest.serialization.Model): """A single file or multiple files to be downloaded to a compute node. - :param auto_storage_container_name: The autoStorageContainerName, storageContainerUrl and + :ivar auto_storage_container_name: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. - :type auto_storage_container_name: str - :param storage_container_url: The autoStorageContainerName, storageContainerUrl and httpUrl + :vartype auto_storage_container_name: str + :ivar storage_container_url: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. - :type storage_container_url: str - :param http_url: The autoStorageContainerName, storageContainerUrl and httpUrl properties are + :vartype storage_container_url: str + :ivar http_url: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. - :type http_url: str - :param blob_prefix: The property is valid only when autoStorageContainerName or + :vartype http_url: str + :ivar blob_prefix: The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. - :type blob_prefix: str - :param file_path: If the httpUrl property is specified, the filePath is required and describes + :vartype blob_prefix: str + :ivar file_path: If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). - :type file_path: str - :param file_mode: This property applies only to files being downloaded to Linux compute nodes. + :vartype file_path: str + :ivar file_mode: This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. - :type file_mode: str - :param identity_reference: The reference to a user assigned identity associated with the Batch + :vartype file_mode: str + :ivar identity_reference: The reference to a user assigned identity associated with the Batch pool which a compute node will use. - :type identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + :vartype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference """ _attribute_map = { @@ -3472,6 +4387,45 @@ def __init__( identity_reference: Optional["ComputeNodeIdentityReference"] = None, **kwargs ): + """ + :keyword auto_storage_container_name: The autoStorageContainerName, storageContainerUrl and + httpUrl properties are mutually exclusive and one of them must be specified. + :paramtype auto_storage_container_name: str + :keyword storage_container_url: The autoStorageContainerName, storageContainerUrl and httpUrl + properties are mutually exclusive and one of them must be specified. This URL must be readable + and listable from compute nodes. There are three ways to get such a URL for a container in + Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on + the container, use a managed identity with read and list permissions, or set the ACL for the + container to allow public access. + :paramtype storage_container_url: str + :keyword http_url: The autoStorageContainerName, storageContainerUrl and httpUrl properties are + mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, + it must be readable from compute nodes. There are three ways to get such a URL for a blob in + Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, + use a managed identity with read permission, or set the ACL for the blob or its container to + allow public access. + :paramtype http_url: str + :keyword blob_prefix: The property is valid only when autoStorageContainerName or + storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a + prefix is not specified, all the files in the container will be downloaded. + :paramtype blob_prefix: str + :keyword file_path: If the httpUrl property is specified, the filePath is required and + describes the path which the file will be downloaded to, including the filename. Otherwise, if + the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional + and is the directory to download the files to. In the case where filePath is used as a + directory, any directory structure already associated with the input data will be retained in + full and appended to the specified filePath directory. The specified relative path cannot break + out of the task's working directory (for example by using '..'). + :paramtype file_path: str + :keyword file_mode: This property applies only to files being downloaded to Linux compute + nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a + Windows node. If this property is not specified for a Linux node, then a default value of 0770 + is applied to the file. + :paramtype file_mode: str + :keyword identity_reference: The reference to a user assigned identity associated with the + Batch pool which a compute node will use. + :paramtype identity_reference: ~azure.mgmt.batch.models.ComputeNodeIdentityReference + """ super(ResourceFile, self).__init__(**kwargs) self.auto_storage_container_name = auto_storage_container_name self.storage_container_url = storage_container_url @@ -3485,12 +4439,12 @@ def __init__( class ScaleSettings(msrest.serialization.Model): """Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. - :param fixed_scale: This property and autoScale are mutually exclusive and one of the - properties must be specified. - :type fixed_scale: ~azure.mgmt.batch.models.FixedScaleSettings - :param auto_scale: This property and fixedScale are mutually exclusive and one of the - properties must be specified. - :type auto_scale: ~azure.mgmt.batch.models.AutoScaleSettings + :ivar fixed_scale: This property and autoScale are mutually exclusive and one of the properties + must be specified. + :vartype fixed_scale: ~azure.mgmt.batch.models.FixedScaleSettings + :ivar auto_scale: This property and fixedScale are mutually exclusive and one of the properties + must be specified. + :vartype auto_scale: ~azure.mgmt.batch.models.AutoScaleSettings """ _attribute_map = { @@ -3505,6 +4459,14 @@ def __init__( auto_scale: Optional["AutoScaleSettings"] = None, **kwargs ): + """ + :keyword fixed_scale: This property and autoScale are mutually exclusive and one of the + properties must be specified. + :paramtype fixed_scale: ~azure.mgmt.batch.models.FixedScaleSettings + :keyword auto_scale: This property and fixedScale are mutually exclusive and one of the + properties must be specified. + :paramtype auto_scale: ~azure.mgmt.batch.models.AutoScaleSettings + """ super(ScaleSettings, self).__init__(**kwargs) self.fixed_scale = fixed_scale self.auto_scale = auto_scale @@ -3535,6 +4497,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -3543,28 +4507,28 @@ def __init__( class StartTask(msrest.serialization.Model): """In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task. - :param command_line: The command line does not run under a shell, and therefore cannot take + :ivar command_line: The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. - :type command_line: str - :param resource_files: A list of files that the Batch service will download to the compute node + :vartype command_line: str + :ivar resource_files: A list of files that the Batch service will download to the compute node before running the command line. - :type resource_files: list[~azure.mgmt.batch.models.ResourceFile] - :param environment_settings: A list of environment variable settings for the start task. - :type environment_settings: list[~azure.mgmt.batch.models.EnvironmentSetting] - :param user_identity: If omitted, the task runs as a non-administrative user unique to the - task. - :type user_identity: ~azure.mgmt.batch.models.UserIdentity - :param max_task_retry_count: The Batch service retries a task if its exit code is nonzero. Note + :vartype resource_files: list[~azure.mgmt.batch.models.ResourceFile] + :ivar environment_settings: A list of environment variable settings for the start task. + :vartype environment_settings: list[~azure.mgmt.batch.models.EnvironmentSetting] + :ivar user_identity: If omitted, the task runs as a non-administrative user unique to the task. + :vartype user_identity: ~azure.mgmt.batch.models.UserIdentity + :ivar max_task_retry_count: The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch - service retries the task without limit. - :type max_task_retry_count: int - :param wait_for_success: If true and the start task fails on a compute node, the Batch service + service retries the task without limit, however this is not recommended for a start task or any + task. The default value is 0 (no retries). + :vartype max_task_retry_count: int + :ivar wait_for_success: If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state @@ -3572,12 +4536,12 @@ class StartTask(msrest.serialization.Model): complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. - :type wait_for_success: bool - :param container_settings: When this is specified, all directories recursively below the + :vartype wait_for_success: bool + :ivar container_settings: When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. - :type container_settings: ~azure.mgmt.batch.models.TaskContainerSettings + :vartype container_settings: ~azure.mgmt.batch.models.TaskContainerSettings """ _attribute_map = { @@ -3602,6 +4566,44 @@ def __init__( container_settings: Optional["TaskContainerSettings"] = None, **kwargs ): + """ + :keyword command_line: The command line does not run under a shell, and therefore cannot take + advantage of shell features such as environment variable expansion. If you want to take + advantage of such features, you should invoke the shell in the command line, for example using + "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other + properties of the startTask are specified. + :paramtype command_line: str + :keyword resource_files: A list of files that the Batch service will download to the compute + node before running the command line. + :paramtype resource_files: list[~azure.mgmt.batch.models.ResourceFile] + :keyword environment_settings: A list of environment variable settings for the start task. + :paramtype environment_settings: list[~azure.mgmt.batch.models.EnvironmentSetting] + :keyword user_identity: If omitted, the task runs as a non-administrative user unique to the + task. + :paramtype user_identity: ~azure.mgmt.batch.models.UserIdentity + :keyword max_task_retry_count: The Batch service retries a task if its exit code is nonzero. + Note that this value specifically controls the number of retries. The Batch service will try + the task once, and may then retry up to this limit. For example, if the maximum retry count is + 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry + count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the + Batch service retries the task without limit, however this is not recommended for a start task + or any task. The default value is 0 (no retries). + :paramtype max_task_retry_count: int + :keyword wait_for_success: If true and the start task fails on a compute node, the Batch + service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task + has still not completed successfully after all retries, then the Batch service marks the + compute node unusable, and will not schedule tasks to it. This condition can be detected via + the node state and scheduling error detail. If false, the Batch service will not wait for the + start task to complete. In this case, other tasks can start executing on the compute node while + the start task is still running; and even if the start task fails, new tasks will continue to + be scheduled on the node. The default is true. + :paramtype wait_for_success: bool + :keyword container_settings: When this is specified, all directories recursively below the + AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the + container, all task environment variables are mapped into the container, and the task command + line is executed in the container. + :paramtype container_settings: ~azure.mgmt.batch.models.TaskContainerSettings + """ super(StartTask, self).__init__(**kwargs) self.command_line = command_line self.resource_files = resource_files @@ -3641,6 +4643,8 @@ def __init__( self, **kwargs ): + """ + """ super(SupportedSku, self).__init__(**kwargs) self.name = None self.family_name = None @@ -3654,8 +4658,8 @@ class SupportedSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of SKUs available for the Batch service in the location. - :type value: list[~azure.mgmt.batch.models.SupportedSku] + :ivar value: Required. The list of SKUs available for the Batch service in the location. + :vartype value: list[~azure.mgmt.batch.models.SupportedSku] :ivar next_link: The URL to use for getting the next set of results. :vartype next_link: str """ @@ -3676,6 +4680,10 @@ def __init__( value: List["SupportedSku"], **kwargs ): + """ + :keyword value: Required. The list of SKUs available for the Batch service in the location. + :paramtype value: list[~azure.mgmt.batch.models.SupportedSku] + """ super(SupportedSkusResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3686,18 +4694,18 @@ class TaskContainerSettings(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param container_run_options: These additional options are supplied as arguments to the "docker + :ivar container_run_options: These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. - :type container_run_options: str - :param image_name: Required. This is the full image reference, as would be specified to "docker + :vartype container_run_options: str + :ivar image_name: Required. This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. - :type image_name: str - :param registry: This setting can be omitted if was already provided at pool creation. - :type registry: ~azure.mgmt.batch.models.ContainerRegistry - :param working_directory: A flag to indicate where the container task working directory is. The + :vartype image_name: str + :ivar registry: This setting can be omitted if was already provided at pool creation. + :vartype registry: ~azure.mgmt.batch.models.ContainerRegistry + :ivar working_directory: A flag to indicate where the container task working directory is. The default is 'taskWorkingDirectory'. Possible values include: "TaskWorkingDirectory", "ContainerImageDefault". - :type working_directory: str or ~azure.mgmt.batch.models.ContainerWorkingDirectory + :vartype working_directory: str or ~azure.mgmt.batch.models.ContainerWorkingDirectory """ _validation = { @@ -3720,6 +4728,21 @@ def __init__( working_directory: Optional[Union[str, "ContainerWorkingDirectory"]] = None, **kwargs ): + """ + :keyword container_run_options: These additional options are supplied as arguments to the + "docker create" command, in addition to those controlled by the Batch Service. + :paramtype container_run_options: str + :keyword image_name: Required. This is the full image reference, as would be specified to + "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a + default. + :paramtype image_name: str + :keyword registry: This setting can be omitted if was already provided at pool creation. + :paramtype registry: ~azure.mgmt.batch.models.ContainerRegistry + :keyword working_directory: A flag to indicate where the container task working directory is. + The default is 'taskWorkingDirectory'. Possible values include: "TaskWorkingDirectory", + "ContainerImageDefault". + :paramtype working_directory: str or ~azure.mgmt.batch.models.ContainerWorkingDirectory + """ super(TaskContainerSettings, self).__init__(**kwargs) self.container_run_options = container_run_options self.image_name = image_name @@ -3732,9 +4755,9 @@ class TaskSchedulingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param node_fill_type: Required. How tasks should be distributed across compute nodes. Possible + :ivar node_fill_type: Required. How tasks should be distributed across compute nodes. Possible values include: "Spread", "Pack". - :type node_fill_type: str or ~azure.mgmt.batch.models.ComputeNodeFillType + :vartype node_fill_type: str or ~azure.mgmt.batch.models.ComputeNodeFillType """ _validation = { @@ -3751,6 +4774,11 @@ def __init__( node_fill_type: Union[str, "ComputeNodeFillType"], **kwargs ): + """ + :keyword node_fill_type: Required. How tasks should be distributed across compute nodes. + Possible values include: "Spread", "Pack". + :paramtype node_fill_type: str or ~azure.mgmt.batch.models.ComputeNodeFillType + """ super(TaskSchedulingPolicy, self).__init__(**kwargs) self.node_fill_type = node_fill_type @@ -3760,21 +4788,21 @@ class UserAccount(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the user account. - :type name: str - :param password: Required. The password for the user account. - :type password: str - :param elevation_level: nonAdmin - The auto user is a standard user without elevated access. + :ivar name: Required. The name of the user account. + :vartype name: str + :ivar password: Required. The password for the user account. + :vartype password: str + :ivar elevation_level: nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: "NonAdmin", "Admin". - :type elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel - :param linux_user_configuration: This property is ignored if specified on a Windows pool. If - not specified, the user is created with the default options. - :type linux_user_configuration: ~azure.mgmt.batch.models.LinuxUserConfiguration - :param windows_user_configuration: This property can only be specified if the user is on a + :vartype elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel + :ivar linux_user_configuration: This property is ignored if specified on a Windows pool. If not + specified, the user is created with the default options. + :vartype linux_user_configuration: ~azure.mgmt.batch.models.LinuxUserConfiguration + :ivar windows_user_configuration: This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. - :type windows_user_configuration: ~azure.mgmt.batch.models.WindowsUserConfiguration + :vartype windows_user_configuration: ~azure.mgmt.batch.models.WindowsUserConfiguration """ _validation = { @@ -3800,6 +4828,23 @@ def __init__( windows_user_configuration: Optional["WindowsUserConfiguration"] = None, **kwargs ): + """ + :keyword name: Required. The name of the user account. + :paramtype name: str + :keyword password: Required. The password for the user account. + :paramtype password: str + :keyword elevation_level: nonAdmin - The auto user is a standard user without elevated access. + admin - The auto user is a user with elevated access and operates with full Administrator + permissions. The default value is nonAdmin. Possible values include: "NonAdmin", "Admin". + :paramtype elevation_level: str or ~azure.mgmt.batch.models.ElevationLevel + :keyword linux_user_configuration: This property is ignored if specified on a Windows pool. If + not specified, the user is created with the default options. + :paramtype linux_user_configuration: ~azure.mgmt.batch.models.LinuxUserConfiguration + :keyword windows_user_configuration: This property can only be specified if the user is on a + Windows pool. If not specified and on a Windows pool, the user is created with the default + options. + :paramtype windows_user_configuration: ~azure.mgmt.batch.models.WindowsUserConfiguration + """ super(UserAccount, self).__init__(**kwargs) self.name = name self.password = password @@ -3833,6 +4878,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentities, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -3841,12 +4888,12 @@ def __init__( class UserIdentity(msrest.serialization.Model): """Specify either the userName or autoUser property, but not both. - :param user_name: The userName and autoUser properties are mutually exclusive; you must specify + :ivar user_name: The userName and autoUser properties are mutually exclusive; you must specify one but not both. - :type user_name: str - :param auto_user: The userName and autoUser properties are mutually exclusive; you must specify + :vartype user_name: str + :ivar auto_user: The userName and autoUser properties are mutually exclusive; you must specify one but not both. - :type auto_user: ~azure.mgmt.batch.models.AutoUserSpecification + :vartype auto_user: ~azure.mgmt.batch.models.AutoUserSpecification """ _attribute_map = { @@ -3861,6 +4908,14 @@ def __init__( auto_user: Optional["AutoUserSpecification"] = None, **kwargs ): + """ + :keyword user_name: The userName and autoUser properties are mutually exclusive; you must + specify one but not both. + :paramtype user_name: str + :keyword auto_user: The userName and autoUser properties are mutually exclusive; you must + specify one but not both. + :paramtype auto_user: ~azure.mgmt.batch.models.AutoUserSpecification + """ super(UserIdentity, self).__init__(**kwargs) self.user_name = user_name self.auto_user = auto_user @@ -3871,45 +4926,45 @@ class VirtualMachineConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param image_reference: Required. A reference to an Azure Virtual Machines Marketplace image or + :ivar image_reference: Required. A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. - :type image_reference: ~azure.mgmt.batch.models.ImageReference - :param node_agent_sku_id: Required. The Batch node agent is a program that runs on each node in + :vartype image_reference: ~azure.mgmt.batch.models.ImageReference + :ivar node_agent_sku_id: Required. The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. - :type node_agent_sku_id: str - :param windows_configuration: This property must not be specified if the imageReference + :vartype node_agent_sku_id: str + :ivar windows_configuration: This property must not be specified if the imageReference specifies a Linux OS image. - :type windows_configuration: ~azure.mgmt.batch.models.WindowsConfiguration - :param data_disks: This property must be specified if the compute nodes in the pool need to - have empty data disks attached to them. - :type data_disks: list[~azure.mgmt.batch.models.DataDisk] - :param license_type: This only applies to images that contain the Windows operating system, and + :vartype windows_configuration: ~azure.mgmt.batch.models.WindowsConfiguration + :ivar data_disks: This property must be specified if the compute nodes in the pool need to have + empty data disks attached to them. + :vartype data_disks: list[~azure.mgmt.batch.models.DataDisk] + :ivar license_type: This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: Windows_Server - The on-premises license is for Windows Server. Windows_Client - The on-premises license is for Windows Client. - :type license_type: str - :param container_configuration: If specified, setup is performed on each node in the pool to + :vartype license_type: str + :ivar container_configuration: If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. - :type container_configuration: ~azure.mgmt.batch.models.ContainerConfiguration - :param disk_encryption_configuration: If specified, encryption is performed on each node in the + :vartype container_configuration: ~azure.mgmt.batch.models.ContainerConfiguration + :ivar disk_encryption_configuration: If specified, encryption is performed on each node in the pool during node provisioning. - :type disk_encryption_configuration: ~azure.mgmt.batch.models.DiskEncryptionConfiguration - :param node_placement_configuration: This configuration will specify rules on how nodes in the + :vartype disk_encryption_configuration: ~azure.mgmt.batch.models.DiskEncryptionConfiguration + :ivar node_placement_configuration: This configuration will specify rules on how nodes in the pool will be physically allocated. - :type node_placement_configuration: ~azure.mgmt.batch.models.NodePlacementConfiguration - :param extensions: If specified, the extensions mentioned in this configuration will be + :vartype node_placement_configuration: ~azure.mgmt.batch.models.NodePlacementConfiguration + :ivar extensions: If specified, the extensions mentioned in this configuration will be installed on each node. - :type extensions: list[~azure.mgmt.batch.models.VMExtension] - :param os_disk: Contains configuration for ephemeral OSDisk settings. - :type os_disk: ~azure.mgmt.batch.models.OSDisk + :vartype extensions: list[~azure.mgmt.batch.models.VMExtension] + :ivar os_disk: Contains configuration for ephemeral OSDisk settings. + :vartype os_disk: ~azure.mgmt.batch.models.OSDisk """ _validation = { @@ -3945,6 +5000,47 @@ def __init__( os_disk: Optional["OSDisk"] = None, **kwargs ): + """ + :keyword image_reference: Required. A reference to an Azure Virtual Machines Marketplace image + or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences + verified by Azure Batch, see the 'List supported node agent SKUs' operation. + :paramtype image_reference: ~azure.mgmt.batch.models.ImageReference + :keyword node_agent_sku_id: Required. The Batch node agent is a program that runs on each node + in the pool, and provides the command-and-control interface between the node and the Batch + service. There are different implementations of the node agent, known as SKUs, for different + operating systems. You must specify a node agent SKU which matches the selected image + reference. To get the list of supported node agent SKUs along with their list of verified image + references, see the 'List supported node agent SKUs' operation. + :paramtype node_agent_sku_id: str + :keyword windows_configuration: This property must not be specified if the imageReference + specifies a Linux OS image. + :paramtype windows_configuration: ~azure.mgmt.batch.models.WindowsConfiguration + :keyword data_disks: This property must be specified if the compute nodes in the pool need to + have empty data disks attached to them. + :paramtype data_disks: list[~azure.mgmt.batch.models.DataDisk] + :keyword license_type: This only applies to images that contain the Windows operating system, + and should only be used when you hold valid on-premises licenses for the nodes which will be + deployed. If omitted, no on-premises licensing discount is applied. Values are: + + Windows_Server - The on-premises license is for Windows Server. + Windows_Client - The on-premises license is for Windows Client. + :paramtype license_type: str + :keyword container_configuration: If specified, setup is performed on each node in the pool to + allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must + specify the containerSettings property, and all other tasks may specify it. + :paramtype container_configuration: ~azure.mgmt.batch.models.ContainerConfiguration + :keyword disk_encryption_configuration: If specified, encryption is performed on each node in + the pool during node provisioning. + :paramtype disk_encryption_configuration: ~azure.mgmt.batch.models.DiskEncryptionConfiguration + :keyword node_placement_configuration: This configuration will specify rules on how nodes in + the pool will be physically allocated. + :paramtype node_placement_configuration: ~azure.mgmt.batch.models.NodePlacementConfiguration + :keyword extensions: If specified, the extensions mentioned in this configuration will be + installed on each node. + :paramtype extensions: list[~azure.mgmt.batch.models.VMExtension] + :keyword os_disk: Contains configuration for ephemeral OSDisk settings. + :paramtype os_disk: ~azure.mgmt.batch.models.OSDisk + """ super(VirtualMachineConfiguration, self).__init__(**kwargs) self.image_reference = image_reference self.node_agent_sku_id = node_agent_sku_id @@ -3983,6 +5079,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineFamilyCoreQuota, self).__init__(**kwargs) self.name = None self.core_quota = None @@ -3993,26 +5091,26 @@ class VMExtension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the virtual machine extension. - :type name: str - :param publisher: Required. The name of the extension handler publisher. - :type publisher: str - :param type: Required. The type of the extensions. - :type type: str - :param type_handler_version: The version of script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + :ivar name: Required. The name of the virtual machine extension. + :vartype name: str + :ivar publisher: Required. The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Required. The type of the extensions. + :vartype type: str + :ivar type_handler_version: The version of script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Any object. - :type settings: any - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Any object. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: any - :param provision_after_extensions: Collection of extension names after which this extension + :vartype protected_settings: any + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] """ _validation = { @@ -4045,6 +5143,28 @@ def __init__( provision_after_extensions: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: Required. The name of the virtual machine extension. + :paramtype name: str + :keyword publisher: Required. The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Required. The type of the extensions. + :paramtype type: str + :keyword type_handler_version: The version of script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Any object. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + """ super(VMExtension, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -4059,8 +5179,8 @@ def __init__( class WindowsConfiguration(msrest.serialization.Model): """Windows operating system settings to apply to the virtual machine. - :param enable_automatic_updates: If omitted, the default value is true. - :type enable_automatic_updates: bool + :ivar enable_automatic_updates: If omitted, the default value is true. + :vartype enable_automatic_updates: bool """ _attribute_map = { @@ -4073,6 +5193,10 @@ def __init__( enable_automatic_updates: Optional[bool] = None, **kwargs ): + """ + :keyword enable_automatic_updates: If omitted, the default value is true. + :paramtype enable_automatic_updates: bool + """ super(WindowsConfiguration, self).__init__(**kwargs) self.enable_automatic_updates = enable_automatic_updates @@ -4080,10 +5204,10 @@ def __init__( class WindowsUserConfiguration(msrest.serialization.Model): """Properties used to create a user account on a Windows node. - :param login_mode: Specifies login mode for the user. The default value for + :ivar login_mode: Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: "Batch", "Interactive". - :type login_mode: str or ~azure.mgmt.batch.models.LoginMode + :vartype login_mode: str or ~azure.mgmt.batch.models.LoginMode """ _attribute_map = { @@ -4096,5 +5220,11 @@ def __init__( login_mode: Optional[Union[str, "LoginMode"]] = None, **kwargs ): + """ + :keyword login_mode: Specifies login mode for the user. The default value for + VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools + is batch mode. Possible values include: "Batch", "Interactive". + :paramtype login_mode: str or ~azure.mgmt.batch.models.LoginMode + """ super(WindowsUserConfiguration, self).__init__(**kwargs) self.login_mode = login_mode diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_operations.py index b2a6ff31ee2d..d1aa63d929df 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_operations.py @@ -5,23 +5,231 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request( + resource_group_name: str, + account_name: str, + application_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + application_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + application_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + account_name: str, + application_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ApplicationOperations(object): """ApplicationOperations operations. @@ -45,15 +253,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - parameters=None, # type: Optional["_models.Application"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + account_name: str, + application_name: str, + parameters: Optional["_models.Application"] = None, + **kwargs: Any + ) -> "_models.Application": """Adds an application to the specified Batch account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -74,36 +282,26 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + _json = self._serialize.body(parameters, 'Application') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,16 +315,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + application_name: str, + **kwargs: Any + ) -> None: """Deletes an application. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -145,28 +345,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,14 +369,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + account_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.Application": """Gets information about the specified application. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -205,28 +396,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,17 +421,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - parameters, # type: "_models.Application" - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + account_name: str, + application_name: str, + parameters: "_models.Application", + **kwargs: Any + ) -> "_models.Application": """Updates settings for the specified application. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -271,33 +454,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Application') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -311,16 +484,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListApplicationsResult"] + resource_group_name: str, + account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ListApplicationsResult"]: """Lists all of the applications in the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -330,7 +505,8 @@ def list( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListApplicationsResult or the result of cls(response) + :return: An iterator like instance of either ListApplicationsResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListApplicationsResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -339,38 +515,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListApplicationsResult', pipeline_response) + deserialized = self._deserialize("ListApplicationsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -388,6 +561,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_package_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_package_operations.py index 961d0bc6c1c8..2245f75e4f00 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_package_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_application_package_operations.py @@ -5,23 +5,241 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_activate_request( + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "versionName": _SERIALIZER.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "versionName": _SERIALIZER.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "versionName": _SERIALIZER.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "versionName": _SERIALIZER.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + account_name: str, + application_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ApplicationPackageOperations(object): """ApplicationPackageOperations operations. @@ -45,16 +263,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def activate( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - version_name, # type: str - parameters, # type: "_models.ActivateApplicationPackageParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationPackage" + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + parameters: "_models.ActivateApplicationPackageParameters", + **kwargs: Any + ) -> "_models.ApplicationPackage": """Activates the specified application package. This should be done after the ``ApplicationPackage`` was created and uploaded. This needs to be done before an ``ApplicationPackage`` can be used on Pools or Tasks. @@ -79,34 +297,24 @@ def activate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.activate.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') + + request = build_activate_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.activate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,18 +328,20 @@ def activate( return cls(pipeline_response, deserialized, {}) return deserialized + activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - version_name, # type: str - parameters=None, # type: Optional["_models.ApplicationPackage"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationPackage" + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + parameters: Optional["_models.ApplicationPackage"] = None, + **kwargs: Any + ) -> "_models.ApplicationPackage": """Creates an application package record. The record contains a storageUrl where the package should be uploaded to. Once it is uploaded the ``ApplicationPackage`` needs to be activated using ``ApplicationPackageActive`` before it can be used. If the auto storage account was @@ -157,37 +367,27 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ApplicationPackage') + _json = self._serialize.body(parameters, 'ApplicationPackage') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -201,17 +401,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + **kwargs: Any + ) -> None: """Deletes an application package record and its associated binary file. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -232,29 +434,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -267,15 +459,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - version_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationPackage" + resource_group_name: str, + account_name: str, + application_name: str, + version_name: str, + **kwargs: Any + ) -> "_models.ApplicationPackage": """Gets information about the specified application package. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -296,29 +489,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'versionName': self._serialize.url("version_name", version_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + version_name=version_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -332,17 +515,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - application_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListApplicationPackagesResult"] + resource_group_name: str, + account_name: str, + application_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ListApplicationPackagesResult"]: """Lists all of the application packages in the specified application. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -354,7 +539,8 @@ def list( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListApplicationPackagesResult or the result of cls(response) + :return: An iterator like instance of either ListApplicationPackagesResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListApplicationPackagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -363,39 +549,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListApplicationPackagesResult', pipeline_response) + deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -413,6 +597,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_batch_account_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_batch_account_operations.py index 3ec8b43ada9f..d649bee6d8dc 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_batch_account_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_batch_account_operations.py @@ -5,25 +5,471 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_synchronize_auto_storage_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_keys_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_detectors_request( + resource_group_name: str, + subscription_id: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_detector_request( + resource_group_name: str, + subscription_id: str, + account_name: str, + detector_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "detectorId": _SERIALIZER.url("detector_id", detector_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_outbound_network_dependencies_endpoints_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BatchAccountOperations(object): """BatchAccountOperations operations. @@ -49,43 +495,32 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BatchAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BatchAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.BatchAccountCreateParameters", + **kwargs: Any + ) -> Optional["_models.BatchAccount"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BatchAccount"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BatchAccountCreateParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -93,29 +528,32 @@ def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('BatchAccount', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BatchAccountCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BatchAccount"] + resource_group_name: str, + account_name: str, + parameters: "_models.BatchAccountCreateParameters", + **kwargs: Any + ) -> LROPoller["_models.BatchAccount"]: """Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. @@ -131,15 +569,19 @@ def begin_create( :type parameters: ~azure.mgmt.batch.models.BatchAccountCreateParameters :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. + :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 BatchAccount or the result of cls(response) + :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 BatchAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.BatchAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,27 +593,21 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BatchAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -183,16 +619,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BatchAccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BatchAccount" + resource_group_name: str, + account_name: str, + parameters: "_models.BatchAccountUpdateParameters", + **kwargs: Any + ) -> "_models.BatchAccount": """Updates the properties of an existing Batch account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -211,32 +648,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BatchAccountUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -250,41 +677,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,19 +714,21 @@ def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified Batch account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -317,15 +737,17 @@ def begin_delete( :type account_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,21 +761,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -365,15 +780,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BatchAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BatchAccount": """Gets information about the specified Batch account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -390,27 +806,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -424,17 +830,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BatchAccountListResult"] + **kwargs: Any + ) -> Iterable["_models.BatchAccountListResult"]: """Gets information about the Batch accounts associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BatchAccountListResult or the result of cls(response) + :return: An iterator like instance of either BatchAccountListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -443,34 +852,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('BatchAccountListResult', pipeline_response) + deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -488,23 +892,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BatchAccountListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.BatchAccountListResult"]: """Gets information about the Batch accounts associated with the specified resource group. :param resource_group_name: The name of the resource group that contains the Batch account. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BatchAccountListResult or the result of cls(response) + :return: An iterator like instance of either BatchAccountListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -513,35 +919,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('BatchAccountListResult', pipeline_response) + deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -559,18 +961,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + @distributed_trace def synchronize_auto_storage_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Synchronizes access keys for the auto-storage account configured for the specified Batch account, only if storage key authentication is being used. @@ -588,27 +991,17 @@ def synchronize_auto_storage_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.synchronize_auto_storage_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_synchronize_auto_storage_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.synchronize_auto_storage_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -621,14 +1014,15 @@ def synchronize_auto_storage_keys( synchronize_auto_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.BatchAccountRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.BatchAccountKeys" + resource_group_name: str, + account_name: str, + parameters: "_models.BatchAccountRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.BatchAccountKeys": """Regenerates the specified account key for the Batch account. This operation applies only to Batch accounts with allowedAuthenticationModes containing @@ -652,32 +1046,22 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -691,15 +1075,17 @@ def regenerate_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'} # type: ignore + + @distributed_trace def get_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BatchAccountKeys" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.BatchAccountKeys": """Gets the account keys for the specified Batch account. This operation applies only to Batch accounts with allowedAuthenticationModes containing @@ -721,27 +1107,17 @@ def get_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.get_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -755,15 +1131,145 @@ def get_keys( return cls(pipeline_response, deserialized, {}) return deserialized + get_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'} # type: ignore + + @distributed_trace + def list_detectors( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.DetectorListResult"]: + """Gets information about the detectors available for a given Batch account. + + :param resource_group_name: The name of the resource group that contains the Batch account. + :type resource_group_name: str + :param account_name: The name of the Batch account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DetectorListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.DetectorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_detectors_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + template_url=self.list_detectors.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_detectors_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + template_url=next_link, + ) + 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("DetectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors'} # type: ignore + + @distributed_trace + def get_detector( + self, + resource_group_name: str, + account_name: str, + detector_id: str, + **kwargs: Any + ) -> "_models.DetectorResponse": + """Gets information about the given detector for a given Batch account. + + :param resource_group_name: The name of the resource group that contains the Batch account. + :type resource_group_name: str + :param account_name: The name of the Batch account. + :type account_name: str + :param detector_id: The name of the detector. + :type detector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DetectorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.batch.models.DetectorResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_detector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + account_name=account_name, + detector_id=detector_id, + template_url=self.get_detector.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DetectorResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}'} # type: ignore + + + @distributed_trace def list_outbound_network_dependencies_endpoints( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OutboundEnvironmentEndpointCollection"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: """Lists the endpoints that a Batch Compute Node under this Batch Account may call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you specify, you must make sure your network allows outbound access to these endpoints. Failure to @@ -776,8 +1282,10 @@ def list_outbound_network_dependencies_endpoints( :param account_name: The name of the Batch account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] @@ -785,36 +1293,33 @@ def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + 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('OutboundEnvironmentEndpointCollection', pipeline_response) + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -832,6 +1337,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_certificate_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_certificate_operations.py index c2263bcfa00e..5c08d4507fe8 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_certificate_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_certificate_operations.py @@ -5,25 +5,285 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_batch_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + select: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + account_name: str, + certificate_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + account_name: str, + certificate_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + account_name: str, + certificate_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + certificate_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_cancel_deletion_request( + resource_group_name: str, + account_name: str, + certificate_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CertificateOperations(object): """CertificateOperations operations. @@ -47,16 +307,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, - resource_group_name, # type: str - account_name, # type: str - maxresults=None, # type: Optional[int] - select=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListCertificatesResult"] + resource_group_name: str, + account_name: str, + maxresults: Optional[int] = None, + select: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListCertificatesResult"]: """Lists all of the certificates in the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -73,7 +333,8 @@ def list_by_batch_account( "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListCertificatesResult or the result of cls(response) + :return: An iterator like instance of either ListCertificatesResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListCertificatesResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -82,42 +343,39 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=next_link, + ) + 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('ListCertificatesResult', pipeline_response) + deserialized = self._deserialize("ListCertificatesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,22 +393,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateOrUpdateParameters" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Certificate" + resource_group_name: str, + account_name: str, + certificate_name: str, + parameters: "_models.CertificateCreateOrUpdateParameters", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Certificate": """Creates a new certificate inside the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -180,37 +439,25 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -220,24 +467,27 @@ def create( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - parameters, # type: "_models.CertificateCreateOrUpdateParameters" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Certificate" + resource_group_name: str, + account_name: str, + certificate_name: str, + parameters: "_models.CertificateCreateOrUpdateParameters", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Certificate": """Updates the properties of an existing certificate. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -263,35 +513,24 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -301,49 +540,41 @@ def update( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -355,20 +586,22 @@ def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified certificate. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -381,15 +614,17 @@ def begin_delete( :type certificate_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -404,22 +639,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -431,16 +658,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Certificate" + resource_group_name: str, + account_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.Certificate": """Gets information about the specified certificate. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -461,28 +689,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -492,22 +710,25 @@ def get( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def cancel_deletion( self, - resource_group_name, # type: str - account_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Certificate" + resource_group_name: str, + account_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.Certificate": """Cancels a failed deletion of a certificate from the specified account. If you try to delete a certificate that is being used by a pool or compute node, the status of @@ -535,28 +756,18 @@ def cancel_deletion( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.cancel_deletion.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', max_length=45, min_length=5, pattern=r'^[\w]+-[\w]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_deletion_request( + resource_group_name=resource_group_name, + account_name=account_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + template_url=self.cancel_deletion.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -566,10 +777,13 @@ def cancel_deletion( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Certificate', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + cancel_deletion.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_location_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_location_operations.py index bbdf5ed2729f..25678be252e2 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_location_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_location_operations.py @@ -5,23 +5,181 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_quotas_request( + location_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_supported_virtual_machine_skus_request( + location_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_supported_cloud_service_skus_request( + location_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + location_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability') + path_format_arguments = { + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LocationOperations(object): """LocationOperations operations. @@ -45,12 +203,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_quotas( self, - location_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BatchLocationQuota" + location_name: str, + **kwargs: Any + ) -> "_models.BatchLocationQuota": """Gets the Batch service quotas for the specified subscription at the given location. :param location_name: The region for which to retrieve Batch service quotas. @@ -65,26 +223,16 @@ def get_quotas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_quotas.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_quotas_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + template_url=self.get_quotas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,16 +246,18 @@ def get_quotas( return cls(pipeline_response, deserialized, {}) return deserialized + get_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas'} # type: ignore + + @distributed_trace def list_supported_virtual_machine_skus( self, - location_name, # type: str - maxresults=None, # type: Optional[int] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SupportedSkusResult"] + location_name: str, + maxresults: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SupportedSkusResult"]: """Gets the list of Batch supported Virtual Machine VM sizes available at the given location. :param location_name: The region for which to retrieve Batch service supported SKUs. @@ -126,39 +276,35 @@ def list_supported_virtual_machine_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_supported_virtual_machine_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_virtual_machine_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=self.list_supported_virtual_machine_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_virtual_machine_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=next_link, + ) + 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('SupportedSkusResult', pipeline_response) + deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -176,19 +322,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_supported_virtual_machine_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus'} # type: ignore + @distributed_trace def list_supported_cloud_service_skus( self, - location_name, # type: str - maxresults=None, # type: Optional[int] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SupportedSkusResult"] + location_name: str, + maxresults: Optional[int] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SupportedSkusResult"]: """Gets the list of Batch supported Cloud Service VM sizes available at the given location. :param location_name: The region for which to retrieve Batch service supported SKUs. @@ -207,39 +354,35 @@ def list_supported_cloud_service_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_supported_cloud_service_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_cloud_service_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=self.list_supported_cloud_service_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_supported_cloud_service_skus_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + filter=filter, + template_url=next_link, + ) + 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('SupportedSkusResult', pipeline_response) + deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -257,18 +400,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_supported_cloud_service_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus'} # type: ignore + @distributed_trace def check_name_availability( self, - location_name, # type: str - parameters, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + location_name: str, + parameters: "_models.CheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks whether the Batch account name is available in the specified region. :param location_name: The desired region for the name check. @@ -285,31 +429,21 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,4 +457,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_operations.py index 9034cad6a332..8df807ca6ed0 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_operations.py @@ -5,23 +5,50 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _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: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Batch/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists available operations for the Microsoft.Batch provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + 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('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py index 05a3576a55c9..a5e45dca7bce 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py @@ -5,25 +5,322 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_batch_account_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + maxresults: Optional[int] = None, + select: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + if select is not None: + query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_auto_scale_request( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_resize_request( + resource_group_name: str, + account_name: str, + pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PoolOperations(object): """PoolOperations operations. @@ -47,16 +344,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, - resource_group_name, # type: str - account_name, # type: str - maxresults=None, # type: Optional[int] - select=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListPoolsResult"] + resource_group_name: str, + account_name: str, + maxresults: Optional[int] = None, + select: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ListPoolsResult"]: """Lists all of the pools in the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -93,42 +390,39 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - if select is not None: - query_parameters['$select'] = self._serialize.query("select", select, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + maxresults=maxresults, + select=select, + filter=filter, + template_url=next_link, + ) + 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('ListPoolsResult', pipeline_response) + deserialized = self._deserialize("ListPoolsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -146,22 +440,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools'} # type: ignore + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - parameters, # type: "_models.Pool" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Pool" + resource_group_name: str, + account_name: str, + pool_name: str, + parameters: "_models.Pool", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Pool": """Creates a new pool inside the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -189,37 +484,25 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Pool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Pool') + + request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,24 +512,27 @@ def create( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - parameters, # type: "_models.Pool" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Pool" + resource_group_name: str, + account_name: str, + pool_name: str, + parameters: "_models.Pool", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Pool": """Updates the properties of an existing pool. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -271,35 +557,24 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Pool') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Pool') + + request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -309,49 +584,41 @@ def update( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -363,20 +630,22 @@ def _delete_initial( if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified pool. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -387,15 +656,17 @@ def begin_delete( :type pool_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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +681,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,16 +700,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Pool" + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> "_models.Pool": """Gets information about the specified pool. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -465,28 +729,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -496,22 +750,25 @@ def get( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + + @distributed_trace def disable_auto_scale( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Pool" + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> "_models.Pool": """Disables automatic scaling for a pool. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -530,28 +787,18 @@ def disable_auto_scale( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.disable_auto_scale.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_auto_scale_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.disable_auto_scale.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -561,22 +808,25 @@ def disable_auto_scale( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + disable_auto_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale'} # type: ignore + + @distributed_trace def stop_resize( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Pool" + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> "_models.Pool": """Stops an ongoing resize operation on the pool. This does not restore the pool to its previous state before the resize operation: it only stops @@ -602,28 +852,18 @@ def stop_resize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.stop_resize.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9_-]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_resize_request( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + template_url=self.stop_resize.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -633,10 +873,13 @@ def stop_resize( response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('Pool', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + stop_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize'} # type: ignore + diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_endpoint_connection_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_endpoint_connection_operations.py index 67e38e0ecfcf..dd0b11f03c26 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_endpoint_connection_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_endpoint_connection_operations.py @@ -5,25 +5,153 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_batch_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + maxresults: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class PrivateEndpointConnectionOperations(object): """PrivateEndpointConnectionOperations operations. @@ -47,14 +175,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, - resource_group_name, # type: str - account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListPrivateEndpointConnectionsResult"] + resource_group_name: str, + account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ListPrivateEndpointConnectionsResult"]: """Lists all of the private endpoint connections in the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -64,8 +192,10 @@ def list_by_batch_account( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListPrivateEndpointConnectionsResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] + :return: An iterator like instance of either ListPrivateEndpointConnectionsResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateEndpointConnectionsResult"] @@ -73,38 +203,35 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListPrivateEndpointConnectionsResult', pipeline_response) + deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,19 +249,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets information about the specified private endpoint connection. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -154,28 +282,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,52 +307,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,31 +350,34 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Updates the properties of an existing private endpoint connection. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -284,15 +395,19 @@ def begin_update( :type if_match: 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. + :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 PrivateEndpointConnection or the result of cls(response) + :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 PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -306,28 +421,21 @@ def begin_update( private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -339,4 +447,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_link_resource_operations.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_link_resource_operations.py index 2060140f580e..8e3d15504ab7 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_link_resource_operations.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_private_link_resource_operations.py @@ -5,23 +5,101 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_by_batch_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + maxresults: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if maxresults is not None: + query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourceOperations(object): """PrivateLinkResourceOperations operations. @@ -45,14 +123,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_batch_account( self, - resource_group_name, # type: str - account_name, # type: str - maxresults=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListPrivateLinkResourcesResult"] + resource_group_name: str, + account_name: str, + maxresults: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ListPrivateLinkResourcesResult"]: """Lists all of the private link resources in the specified account. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -62,7 +140,8 @@ def list_by_batch_account( :param maxresults: The maximum number of items to return in the response. :type maxresults: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListPrivateLinkResourcesResult or the result of cls(response) + :return: An iterator like instance of either ListPrivateLinkResourcesResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPrivateLinkResourcesResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,38 +150,35 @@ def list_by_batch_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_batch_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=self.list_by_batch_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_batch_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + maxresults=maxresults, + template_url=next_link, + ) + 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('ListPrivateLinkResourcesResult', pipeline_response) + deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,19 +196,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + account_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Gets information about the specified private link resource. :param resource_group_name: The name of the resource group that contains the Batch account. @@ -152,28 +229,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3, pattern=r'^[a-zA-Z0-9]+$'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str', max_length=101, min_length=1, pattern=r'^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,4 +254,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore +