diff --git a/sdk/batch/azure-mgmt-batch/_meta.json b/sdk/batch/azure-mgmt-batch/_meta.json index 3e02f4c552c2..c00ccd67b976 100644 --- a/sdk/batch/azure-mgmt-batch/_meta.json +++ b/sdk/batch/azure-mgmt-batch/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "3f59f46d112c58cb8f6231732e88848f0f97872c", + "commit": "12d012d12a150facb62baf2daee9bb4bf147350b", "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/batch/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.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/_batch_management_client.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py index 8a21ad06f59c..ce3f8284efbf 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer 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 @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class BatchManagementClient: +class BatchManagementClient: # pylint: disable=too-many-instance-attributes """Batch Client. :ivar batch_account: BatchAccountOperations operations @@ -48,8 +49,11 @@ class BatchManagementClient: :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -81,7 +85,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 ecb96ee47c70..f67b4b421e9e 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class BatchManagementClientConfiguration(Configuration): +class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BatchManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class BatchManagementClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(BatchManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION)) self._configure(**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 09c04c4d7e68..53ef74f54103 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2022-01-01", - "total_api_version_list": ["2022-01-01"], + "chosen_version": "2022-06-01", + "total_api_version_list": ["2022-06-01"], "client": { "name": "BatchManagementClient", "filename": "_batch_management_client", @@ -10,8 +10,8 @@ "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\"]}}}", - "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\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"BatchManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { 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 7985a146bc0e..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.1.0" +VERSION = "14.0.0b1" 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 3b1570f8a34f..76d10a467aea 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer 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 @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class BatchManagementClient: +class BatchManagementClient: # pylint: disable=too-many-instance-attributes """Batch Client. :ivar batch_account: BatchAccountOperations operations @@ -48,8 +49,11 @@ class BatchManagementClient: :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ 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 6f34152872c5..d33e34cbe6be 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class BatchManagementClientConfiguration(Configuration): +class BatchManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BatchManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class BatchManagementClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(BatchManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-batch/{}'.format(VERSION)) self._configure(**kwargs) 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 a4187f4ad699..69a60adc2147 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -63,7 +62,7 @@ async def create( :type account_name: str :param application_name: The name of the application. This must be unique within the account. :type application_name: str - :param parameters: The parameters for the request. + :param parameters: The parameters for the request. Default value is None. :type parameters: ~azure.mgmt.batch.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) @@ -76,6 +75,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -88,6 +88,7 @@ async def create( account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -95,7 +96,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,11 +114,11 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -139,18 +144,25 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.delete.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -160,7 +172,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace_async @@ -190,18 +202,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -215,7 +234,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace_async @@ -248,6 +267,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Application') @@ -257,6 +277,7 @@ async def update( account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -264,7 +285,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,7 +303,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace @@ -295,7 +320,8 @@ def list( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -304,6 +330,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -316,6 +344,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=self.list.metadata['url'], ) @@ -328,6 +357,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -346,7 +376,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -359,4 +393,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications"} # type: ignore 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 25ea2e2a2920..6d261d671fd4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -81,6 +80,7 @@ async def activate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') @@ -91,6 +91,7 @@ async def activate( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.activate.metadata['url'], @@ -98,7 +99,11 @@ async def activate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,7 +117,7 @@ async def activate( return deserialized - activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate'} # type: ignore + activate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate"} # type: ignore @distributed_trace_async @@ -138,7 +143,7 @@ async def create( :type application_name: str :param version_name: The version of the application. :type version_name: str - :param parameters: The parameters for the request. + :param parameters: The parameters for the request. Default value is None. :type parameters: ~azure.mgmt.batch.models.ApplicationPackage :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationPackage, or the result of cls(response) @@ -151,6 +156,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -164,6 +170,7 @@ async def create( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -171,7 +178,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,11 +196,11 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -218,6 +229,8 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, @@ -225,12 +238,17 @@ async def delete( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -240,7 +258,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace_async @@ -273,6 +291,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -280,12 +300,17 @@ async def get( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -299,7 +324,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace @@ -319,7 +344,8 @@ def list( :type account_name: str :param application_name: The name of the application. This must be unique within the account. :type application_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -328,6 +354,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListApplicationPackagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationPackagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -341,6 +369,7 @@ def prepare_request(next_link=None): account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=self.list.metadata['url'], ) @@ -354,6 +383,7 @@ def prepare_request(next_link=None): account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -372,7 +402,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -385,4 +419,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions"} # type: ignore 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 c8c47ccb4d74..2ab82079ee46 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -61,6 +60,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountCreateParameters') @@ -69,6 +69,7 @@ async def _create_initial( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -98,7 +103,7 @@ async def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace_async @@ -135,8 +140,9 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.BatchAccount] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -148,6 +154,7 @@ async def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -172,10 +179,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace_async async def update( @@ -204,6 +210,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountUpdateParameters') @@ -212,6 +219,7 @@ async def update( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -219,7 +227,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,10 +245,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -248,17 +260,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -274,11 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -302,7 +321,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +333,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -333,10 +354,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace_async async def get( @@ -362,17 +382,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -386,7 +413,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace @@ -403,6 +430,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -413,6 +442,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -422,6 +452,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -439,7 +470,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -452,7 +487,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -471,6 +506,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -482,6 +519,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -492,6 +530,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -509,7 +548,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -522,10 +565,10 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + 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( + async def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -549,17 +592,24 @@ async def synchronize_auto_storage_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_synchronize_auto_storage_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.synchronize_auto_storage_keys.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -569,7 +619,7 @@ async def synchronize_auto_storage_keys( if cls: return cls(pipeline_response, None, {}) - synchronize_auto_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'} # type: ignore + synchronize_auto_storage_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys"} # type: ignore @distributed_trace_async @@ -604,6 +654,7 @@ async def regenerate_key( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') @@ -612,6 +663,7 @@ async def regenerate_key( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_key.metadata['url'], @@ -619,7 +671,11 @@ async def regenerate_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -633,7 +689,7 @@ async def regenerate_key( return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'} # type: ignore + regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys"} # type: ignore @distributed_trace_async @@ -665,17 +721,24 @@ async def get_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_keys.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -689,7 +752,7 @@ async def get_keys( return deserialized - get_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'} # type: ignore + get_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys"} # type: ignore @distributed_trace @@ -710,6 +773,8 @@ def list_detectors( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.DetectorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -722,6 +787,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, account_name=account_name, + api_version=api_version, template_url=self.list_detectors.metadata['url'], ) request = _convert_request(request) @@ -733,6 +799,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, account_name=account_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -750,7 +817,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -763,7 +834,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors'} # type: ignore + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors"} # type: ignore @distributed_trace_async async def get_detector( @@ -792,18 +863,25 @@ async def get_detector( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + 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, + api_version=api_version, 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -817,7 +895,7 @@ async def get_detector( return deserialized - get_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}'} # type: ignore + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"} # type: ignore @distributed_trace @@ -845,6 +923,8 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -857,6 +937,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], ) request = _convert_request(request) @@ -868,6 +949,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -885,7 +967,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -898,4 +984,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints'} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints"} # type: ignore 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 7e6e6957bd58..644cd1d5a4db 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,14 +63,16 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param select: Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for - selection. + selection. Default value is None. :type select: str :param filter: OData filter expression. Valid properties for filtering are - "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". + "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". Default + value is None. :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 @@ -80,6 +81,8 @@ def list_by_batch_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListCertificatesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListCertificatesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -92,6 +95,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -106,6 +110,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -126,7 +131,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,7 +148,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates"} # type: ignore @distributed_trace_async async def create( @@ -166,10 +175,10 @@ async def create( :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters :param if_match: The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply the operation only if the certificate already exists. If omitted, this - operation will always be applied. + operation will always be applied. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new certificate to be created, but to prevent - updating an existing certificate. Other values will be ignored. + updating an existing certificate. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) @@ -182,6 +191,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') @@ -191,6 +201,7 @@ async def create( account_name=account_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -200,7 +211,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -217,7 +232,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async @@ -243,7 +258,7 @@ async def update( :param parameters: Certificate entity to update. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters :param if_match: The entity state (ETag) version of the certificate to update. This value can - be omitted or set to "*" to apply the operation unconditionally. + be omitted or set to "*" to apply the operation unconditionally. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) @@ -256,6 +271,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') @@ -265,6 +281,7 @@ async def update( account_name=account_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -273,7 +290,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -290,10 +311,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -306,18 +327,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self._delete_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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -333,11 +361,11 @@ async def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -366,7 +394,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +407,7 @@ async def begin_delete( resource_group_name=resource_group_name, account_name=account_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -398,10 +428,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async async def get( @@ -432,18 +461,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -460,7 +496,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async @@ -499,18 +535,25 @@ async def cancel_deletion( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.cancel_deletion.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,5 +570,5 @@ async def cancel_deletion( return deserialized - cancel_deletion.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete'} # type: ignore + 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 547e0b92a3a5..dc40d2bf7e64 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -67,16 +66,23 @@ async def get_quotas( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_quotas_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_quotas.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -90,7 +96,7 @@ async def get_quotas( return deserialized - get_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas'} # type: ignore + get_quotas.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas"} # type: ignore @distributed_trace @@ -105,15 +111,19 @@ def list_supported_virtual_machine_skus( :param location_name: The region for which to retrieve Batch service supported SKUs. :type location_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param filter: OData filter expression. Valid properties for filtering are "familyName". + Default value is None. :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 SupportedSkusResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.SupportedSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -125,6 +135,7 @@ def prepare_request(next_link=None): request = build_list_supported_virtual_machine_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=self.list_supported_virtual_machine_skus.metadata['url'], @@ -137,6 +148,7 @@ def prepare_request(next_link=None): request = build_list_supported_virtual_machine_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=next_link, @@ -156,7 +168,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -169,7 +185,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_supported_virtual_machine_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus'} # type: ignore + 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( @@ -183,15 +199,19 @@ def list_supported_cloud_service_skus( :param location_name: The region for which to retrieve Batch service supported SKUs. :type location_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param filter: OData filter expression. Valid properties for filtering are "familyName". + Default value is None. :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 SupportedSkusResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.SupportedSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -203,6 +223,7 @@ def prepare_request(next_link=None): request = build_list_supported_cloud_service_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=self.list_supported_cloud_service_skus.metadata['url'], @@ -215,6 +236,7 @@ def prepare_request(next_link=None): request = build_list_supported_cloud_service_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=next_link, @@ -234,7 +256,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,7 +273,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_supported_cloud_service_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus'} # type: ignore + 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( @@ -273,6 +299,7 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') @@ -280,6 +307,7 @@ async def check_name_availability( request = build_check_name_availability_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -287,7 +315,11 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -301,5 +333,5 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability'} # type: ignore + 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 aac41489d214..a1c905d00d6d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ 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 @@ -58,6 +56,8 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -67,6 +67,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -75,6 +76,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -92,7 +94,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,4 +111,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Batch/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Batch/operations"} # type: ignore 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 8f9bf1b6bc47..0763264e3e72 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,11 +63,12 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param select: Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for - selection. + selection. Default value is None. :type select: str :param filter: OData filter expression. Valid properties for filtering are: @@ -82,13 +82,15 @@ def list_by_batch_account( properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale - properties/scaleSettings/fixedScale. + properties/scaleSettings/fixedScale. Default value is None. :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 ListPoolsResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPoolsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPoolsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -101,6 +103,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -115,6 +118,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -135,7 +139,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -148,7 +156,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools"} # type: ignore @distributed_trace_async async def create( @@ -173,10 +181,10 @@ async def create( :type parameters: ~azure.mgmt.batch.models.Pool :param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the operation only if the pool already exists. If omitted, this operation will - always be applied. + always be applied. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new pool to be created, but to prevent updating an - existing pool. Other values will be ignored. + existing pool. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Pool, or the result of cls(response) @@ -189,6 +197,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Pool') @@ -198,6 +207,7 @@ async def create( account_name=account_name, pool_name=pool_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -207,7 +217,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -224,7 +238,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace_async @@ -249,7 +263,7 @@ async def update( updated, any property not supplied will be unchanged. :type parameters: ~azure.mgmt.batch.models.Pool :param if_match: The entity state (ETag) version of the pool to update. This value can be - omitted or set to "*" to apply the operation unconditionally. + omitted or set to "*" to apply the operation unconditionally. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Pool, or the result of cls(response) @@ -262,6 +276,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Pool') @@ -271,6 +286,7 @@ async def update( account_name=account_name, pool_name=pool_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -279,7 +295,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -296,10 +316,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -312,18 +332,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self._delete_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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -339,11 +366,11 @@ async def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -370,7 +397,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,6 +410,7 @@ async def begin_delete( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -402,10 +431,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace_async async def get( @@ -434,18 +462,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -462,7 +497,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace_async @@ -492,18 +527,25 @@ async def disable_auto_scale( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.disable_auto_scale.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -520,7 +562,7 @@ async def disable_auto_scale( return deserialized - disable_auto_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale'} # type: ignore + disable_auto_scale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale"} # type: ignore @distributed_trace_async @@ -557,18 +599,25 @@ async def stop_resize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.stop_resize.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -585,5 +634,5 @@ async def stop_resize( return deserialized - stop_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize'} # type: ignore + 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 b5e1d89f13ad..8fc8a3f200a8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,7 +21,7 @@ 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 +from ...operations._private_endpoint_connection_operations import build_delete_request_initial, 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]] @@ -62,7 +61,8 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -71,6 +71,8 @@ def list_by_batch_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateEndpointConnectionsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -83,6 +85,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=self.list_by_batch_account.metadata['url'], ) @@ -95,6 +98,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -113,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,7 +134,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( @@ -156,18 +164,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,7 +196,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _update_initial( @@ -199,6 +214,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -208,6 +224,7 @@ async def _update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -216,7 +233,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -238,7 +259,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -264,7 +285,8 @@ async def begin_update( are supplied will be updated, any property not supplied will be unchanged. :type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection :param if_match: The state (ETag) version of the private endpoint connection to update. This - value can be omitted or set to "*" to apply the operation unconditionally. + value can be omitted or set to "*" to apply the operation unconditionally. Default value is + None. :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. @@ -279,8 +301,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -294,6 +317,7 @@ async def begin_update( private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -318,7 +342,123 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_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 = kwargs.pop('api_version', "2022-06-01") # type: str + + + request = build_delete_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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + 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}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection. + + :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 private_endpoint_connection_name: The private endpoint connection name. This must be + unique within the account. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.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 c89d5526b011..8e3a435f39ae 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -60,7 +59,8 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -69,6 +69,8 @@ def list_by_batch_account( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.batch.models.ListPrivateLinkResourcesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateLinkResourcesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -81,6 +83,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=self.list_by_batch_account.metadata['url'], ) @@ -93,6 +96,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -111,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,7 +132,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources"} # type: ignore @distributed_trace_async async def get( @@ -154,18 +162,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,5 +194,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + 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 0de86b5a4b15..af6716ffd7a8 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 @@ -49,10 +49,12 @@ from ._models_py3 import DiffDiskSettings from ._models_py3 import DiskEncryptionConfiguration from ._models_py3 import EncryptionProperties +from ._models_py3 import EndpointAccessProfile from ._models_py3 import EndpointDependency from ._models_py3 import EndpointDetail from ._models_py3 import EnvironmentSetting from ._models_py3 import FixedScaleSettings +from ._models_py3 import IPRule from ._models_py3 import ImageReference from ._models_py3 import InboundNatPool from ._models_py3 import KeyVaultProperties @@ -68,6 +70,7 @@ from ._models_py3 import MountConfiguration from ._models_py3 import NFSMountConfiguration from ._models_py3 import NetworkConfiguration +from ._models_py3 import NetworkProfile from ._models_py3 import NetworkSecurityGroupRule from ._models_py3 import NodePlacementConfiguration from ._models_py3 import OSDisk @@ -122,6 +125,7 @@ DiskEncryptionTarget, DynamicVNetAssignmentScope, ElevationLevel, + EndpointAccessDefaultAction, IPAddressProvisioningType, InboundEndpointProtocol, InterNodeCommunicationState, @@ -186,10 +190,12 @@ 'DiffDiskSettings', 'DiskEncryptionConfiguration', 'EncryptionProperties', + 'EndpointAccessProfile', 'EndpointDependency', 'EndpointDetail', 'EnvironmentSetting', 'FixedScaleSettings', + 'IPRule', 'ImageReference', 'InboundNatPool', 'KeyVaultProperties', @@ -205,6 +211,7 @@ 'MountConfiguration', 'NFSMountConfiguration', 'NetworkConfiguration', + 'NetworkProfile', 'NetworkSecurityGroupRule', 'NodePlacementConfiguration', 'OSDisk', @@ -256,6 +263,7 @@ 'DiskEncryptionTarget', 'DynamicVNetAssignmentScope', 'ElevationLevel', + 'EndpointAccessDefaultAction', 'IPAddressProvisioningType', 'InboundEndpointProtocol', 'InterNodeCommunicationState', 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 94f9dba7d66f..a5b553f83d30 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 @@ -187,8 +187,8 @@ class DynamicVNetAssignmentScope(with_metaclass(CaseInsensitiveEnumMeta, str, En #: 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. + #: Dynamic VNet assignment is done per-job. If this value is set, the network configuration subnet + #: ID must also be set. This feature requires approval before use, please contact support. JOB = "job" class ElevationLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): @@ -200,6 +200,15 @@ class ElevationLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The user is a user with elevated access and operates with full Administrator permissions. ADMIN = "Admin" +class EndpointAccessDefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. + """ + + #: Allow client access. + ALLOW = "Allow" + #: Deny client access. + DENY = "Deny" + class InboundEndpointProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol of the endpoint. """ @@ -326,14 +335,20 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE """The provisioning state of the private endpoint connection. """ - #: The connection status is final and is ready for use if Status is Approved. - SUCCEEDED = "Succeeded" + #: The connection is creating. + CREATING = "Creating" #: The user has requested that the connection status be updated, but the update operation has not #: yet completed. You may not reference the connection when connecting the Batch account. UPDATING = "Updating" + #: The connection is deleting. + DELETING = "Deleting" + #: The connection status is final and is ready for use if Status is Approved. + SUCCEEDED = "Succeeded" #: The user requested that the connection be updated and it failed. You may retry the update #: operation. FAILED = "Failed" + #: The user has cancelled the connection creation. + CANCELLED = "Cancelled" class PrivateLinkServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Batch private endpoint connection 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 e75663227f39..e0a569a0d8da 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 @@ -766,6 +766,9 @@ class BatchAccount(Resource): :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 node_management_endpoint: The endpoint used by compute node to connect to the Batch node + management service. + :vartype node_management_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 @@ -777,6 +780,9 @@ class BatchAccount(Resource): :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :vartype network_profile: ~azure.mgmt.batch.models.NetworkProfile :ivar private_endpoint_connections: List of private endpoint connections associated with the Batch account. :vartype private_endpoint_connections: list[~azure.mgmt.batch.models.PrivateEndpointConnection] @@ -798,13 +804,10 @@ class BatchAccount(Resource): 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. + :ivar dedicated_core_quota_per_vm_family_enforced: If this flag is true, dedicated core quota + is enforced via both the dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota properties on the + account. If this flag is false, dedicated core quota is enforced only via the + dedicatedCoreQuota property on the account and does not consider Virtual Machine family. :vartype dedicated_core_quota_per_vm_family_enforced: bool :ivar pool_quota: The pool quota for the Batch account. :vartype pool_quota: int @@ -824,10 +827,10 @@ class BatchAccount(Resource): 'location': {'readonly': True}, 'tags': {'readonly': True}, 'account_endpoint': {'readonly': True}, + 'node_management_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}, @@ -848,10 +851,12 @@ class BatchAccount(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, 'identity': {'key': 'identity', 'type': 'BatchAccountIdentity'}, 'account_endpoint': {'key': 'properties.accountEndpoint', 'type': 'str'}, + 'node_management_endpoint': {'key': 'properties.nodeManagementEndpoint', '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'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'auto_storage': {'key': 'properties.autoStorage', 'type': 'AutoStorageProperties'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, @@ -868,19 +873,29 @@ def __init__( self, *, identity: Optional["BatchAccountIdentity"] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = "Enabled", + network_profile: Optional["NetworkProfile"] = None, **kwargs ): """ :keyword identity: The identity of the Batch account. :paramtype identity: ~azure.mgmt.batch.models.BatchAccountIdentity + :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :paramtype network_profile: ~azure.mgmt.batch.models.NetworkProfile """ super(BatchAccount, self).__init__(**kwargs) self.identity = identity self.account_endpoint = None + self.node_management_endpoint = None self.provisioning_state = None self.pool_allocation_mode = None self.key_vault_reference = None - self.public_network_access = None + self.public_network_access = public_network_access + self.network_profile = network_profile self.private_endpoint_connections = None self.auto_storage = None self.encryption = None @@ -918,6 +933,9 @@ class BatchAccountCreateParameters(msrest.serialization.Model): :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :vartype network_profile: ~azure.mgmt.batch.models.NetworkProfile :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. @@ -940,6 +958,7 @@ class BatchAccountCreateParameters(msrest.serialization.Model): 'pool_allocation_mode': {'key': 'properties.poolAllocationMode', 'type': 'str'}, 'key_vault_reference': {'key': 'properties.keyVaultReference', 'type': 'KeyVaultReference'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, 'allowed_authentication_modes': {'key': 'properties.allowedAuthenticationModes', 'type': '[str]'}, } @@ -954,6 +973,7 @@ def __init__( pool_allocation_mode: Optional[Union[str, "PoolAllocationMode"]] = None, key_vault_reference: Optional["KeyVaultReference"] = None, public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = "Enabled", + network_profile: Optional["NetworkProfile"] = None, encryption: Optional["EncryptionProperties"] = None, allowed_authentication_modes: Optional[List[Union[str, "AuthenticationMode"]]] = None, **kwargs @@ -979,6 +999,9 @@ def __init__( :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :paramtype network_profile: ~azure.mgmt.batch.models.NetworkProfile :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. @@ -997,6 +1020,7 @@ def __init__( self.pool_allocation_mode = pool_allocation_mode self.key_vault_reference = key_vault_reference self.public_network_access = public_network_access + self.network_profile = network_profile self.encryption = encryption self.allowed_authentication_modes = allowed_authentication_modes @@ -1175,6 +1199,12 @@ class BatchAccountUpdateParameters(msrest.serialization.Model): 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] + :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :vartype network_profile: ~azure.mgmt.batch.models.NetworkProfile """ _attribute_map = { @@ -1183,6 +1213,8 @@ class BatchAccountUpdateParameters(msrest.serialization.Model): 'auto_storage': {'key': 'properties.autoStorage', 'type': 'AutoStorageBaseProperties'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'}, 'allowed_authentication_modes': {'key': 'properties.allowedAuthenticationModes', 'type': '[str]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, } def __init__( @@ -1193,6 +1225,8 @@ def __init__( auto_storage: Optional["AutoStorageBaseProperties"] = None, encryption: Optional["EncryptionProperties"] = None, allowed_authentication_modes: Optional[List[Union[str, "AuthenticationMode"]]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = "Enabled", + network_profile: Optional["NetworkProfile"] = None, **kwargs ): """ @@ -1211,6 +1245,12 @@ def __init__( authentication with the control plane. :paramtype allowed_authentication_modes: list[str or ~azure.mgmt.batch.models.AuthenticationMode] + :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 network_profile: The network profile only takes effect when publicNetworkAccess is + enabled. + :paramtype network_profile: ~azure.mgmt.batch.models.NetworkProfile """ super(BatchAccountUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -1218,6 +1258,8 @@ def __init__( self.auto_storage = auto_storage self.encryption = encryption self.allowed_authentication_modes = allowed_authentication_modes + self.public_network_access = public_network_access + self.network_profile = network_profile class BatchLocationQuota(msrest.serialization.Model): @@ -2451,6 +2493,46 @@ def __init__( self.key_vault_properties = key_vault_properties +class EndpointAccessProfile(msrest.serialization.Model): + """Network access profile for Batch endpoint. + + All required parameters must be populated in order to send to Azure. + + :ivar default_action: Required. Default action for endpoint access. It is only applicable when + publicNetworkAccess is enabled. Possible values include: "Allow", "Deny". + :vartype default_action: str or ~azure.mgmt.batch.models.EndpointAccessDefaultAction + :ivar ip_rules: Array of IP ranges to filter client IP address. + :vartype ip_rules: list[~azure.mgmt.batch.models.IPRule] + """ + + _validation = { + 'default_action': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + } + + def __init__( + self, + *, + default_action: Union[str, "EndpointAccessDefaultAction"], + ip_rules: Optional[List["IPRule"]] = None, + **kwargs + ): + """ + :keyword default_action: Required. Default action for endpoint access. It is only applicable + when publicNetworkAccess is enabled. Possible values include: "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.batch.models.EndpointAccessDefaultAction + :keyword ip_rules: Array of IP ranges to filter client IP address. + :paramtype ip_rules: list[~azure.mgmt.batch.models.IPRule] + """ + super(EndpointAccessProfile, self).__init__(**kwargs) + self.default_action = default_action + self.ip_rules = ip_rules + + class EndpointDependency(msrest.serialization.Model): """A domain name and connection details used to access a dependency. @@ -2778,6 +2860,45 @@ def __init__( self.network_security_group_rules = network_security_group_rules +class IPRule(msrest.serialization.Model): + """Rule to filter client IP address. + + 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 action: Action when client IP address is matched. Has constant value: "Allow". + :vartype action: str + :ivar value: Required. IPv4 address, or IPv4 address range in CIDR format. + :vartype value: str + """ + + _validation = { + 'action': {'required': True, 'constant': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'action': {'key': 'action', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + action = "Allow" + + def __init__( + self, + *, + value: str, + **kwargs + ): + """ + :keyword value: Required. IPv4 address, or IPv4 address range in CIDR format. + :paramtype value: str + """ + super(IPRule, self).__init__(**kwargs) + self.value = value + + class KeyVaultProperties(msrest.serialization.Model): """KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. @@ -3280,6 +3401,42 @@ def __init__( self.public_ip_address_configuration = public_ip_address_configuration +class NetworkProfile(msrest.serialization.Model): + """Network profile for Batch account, which contains network rule settings for each endpoint. + + :ivar account_access: Network access profile for batchAccount endpoint (Batch account data + plane API). + :vartype account_access: ~azure.mgmt.batch.models.EndpointAccessProfile + :ivar node_management_access: Network access profile for nodeManagement endpoint (Batch service + managing compute nodes for Batch pools). + :vartype node_management_access: ~azure.mgmt.batch.models.EndpointAccessProfile + """ + + _attribute_map = { + 'account_access': {'key': 'accountAccess', 'type': 'EndpointAccessProfile'}, + 'node_management_access': {'key': 'nodeManagementAccess', 'type': 'EndpointAccessProfile'}, + } + + def __init__( + self, + *, + account_access: Optional["EndpointAccessProfile"] = None, + node_management_access: Optional["EndpointAccessProfile"] = None, + **kwargs + ): + """ + :keyword account_access: Network access profile for batchAccount endpoint (Batch account data + plane API). + :paramtype account_access: ~azure.mgmt.batch.models.EndpointAccessProfile + :keyword node_management_access: Network access profile for nodeManagement endpoint (Batch + service managing compute nodes for Batch pools). + :paramtype node_management_access: ~azure.mgmt.batch.models.EndpointAccessProfile + """ + super(NetworkProfile, self).__init__(**kwargs) + self.account_access = account_access + self.node_management_access = node_management_access + + class NetworkSecurityGroupRule(msrest.serialization.Model): """A network security group rule to apply to an inbound endpoint. @@ -3709,8 +3866,8 @@ class Pool(ProxyResource): :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 Spot/low-priority compute nodes currently in - the pool. + :ivar current_low_priority_nodes: The number of low-priority compute nodes currently in the + pool. :vartype current_low_priority_nodes: int :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 @@ -4008,11 +4165,13 @@ class PrivateEndpointConnection(ProxyResource): :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". + values include: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Cancelled". :vartype provisioning_state: str or ~azure.mgmt.batch.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The private endpoint of the private endpoint connection. :vartype private_endpoint: ~azure.mgmt.batch.models.PrivateEndpoint + :ivar group_ids: The value has one and only one group id. + :vartype group_ids: list[str] :ivar private_link_service_connection_state: The private link service connection state of the private endpoint connection. :vartype private_link_service_connection_state: @@ -4025,6 +4184,8 @@ class PrivateEndpointConnection(ProxyResource): 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'private_endpoint': {'readonly': True}, + 'group_ids': {'readonly': True}, } _attribute_map = { @@ -4034,19 +4195,17 @@ class PrivateEndpointConnection(ProxyResource): 'etag': {'key': 'etag', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, } def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, 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: @@ -4054,7 +4213,8 @@ def __init__( """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.provisioning_state = None - self.private_endpoint = private_endpoint + self.private_endpoint = None + self.group_ids = None self.private_link_service_connection_state = private_link_service_connection_state @@ -4166,9 +4326,9 @@ class PublicIPAddressConfiguration(msrest.serialization.Model): "UserManaged", "NoPublicIPAddresses". :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: + 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}. :vartype ip_address_ids: list[str] """ @@ -4190,9 +4350,9 @@ def __init__( "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: + 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}. :paramtype ip_address_ids: list[str] """ @@ -4256,8 +4416,7 @@ class ResizeOperationStatus(msrest.serialization.Model): :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. + :ivar target_low_priority_nodes: The desired number of 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 @@ -4297,8 +4456,8 @@ def __init__( """ :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. + :keyword target_low_priority_nodes: The desired number of 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 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 d1aa63d929df..cc56b50b13ee 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ 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 @@ -37,12 +37,12 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}") # pylint: disable=line-too-long 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]+$'), @@ -50,23 +50,23 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,10 +80,11 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}") # pylint: disable=line-too-long 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]+$'), @@ -91,21 +92,21 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -117,10 +118,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}") # pylint: disable=line-too-long 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]+$'), @@ -128,21 +130,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -157,12 +159,12 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}") # pylint: disable=line-too-long 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]+$'), @@ -170,23 +172,23 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -201,33 +203,34 @@ def build_list_request( maxresults: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications") # pylint: disable=line-too-long 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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -270,7 +273,7 @@ def create( :type account_name: str :param application_name: The name of the application. This must be unique within the account. :type application_name: str - :param parameters: The parameters for the request. + :param parameters: The parameters for the request. Default value is None. :type parameters: ~azure.mgmt.batch.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) @@ -283,6 +286,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -295,6 +299,7 @@ def create( account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -302,7 +307,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -316,11 +325,11 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -346,18 +355,25 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -367,7 +383,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace @@ -397,18 +413,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -422,7 +445,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace @@ -455,6 +478,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Application') @@ -464,6 +488,7 @@ def update( account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -471,7 +496,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -485,7 +514,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"} # type: ignore @distributed_trace @@ -502,7 +531,8 @@ def list( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -510,6 +540,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListApplicationsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -522,6 +554,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=self.list.metadata['url'], ) @@ -534,6 +567,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -552,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,4 +603,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications"} # type: ignore 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 2245f75e4f00..ab8fda23ca5b 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ 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 @@ -38,12 +38,12 @@ def build_activate_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate") # pylint: disable=line-too-long 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]+$'), @@ -52,23 +52,23 @@ def build_activate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -86,12 +86,12 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}") # pylint: disable=line-too-long 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]+$'), @@ -100,23 +100,23 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -131,10 +131,11 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}") # pylint: disable=line-too-long 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]+$'), @@ -143,21 +144,21 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,10 +171,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}") # pylint: disable=line-too-long 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]+$'), @@ -182,21 +184,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -210,10 +212,11 @@ def build_list_request( maxresults: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions") # pylint: disable=line-too-long 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]+$'), @@ -221,23 +224,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -298,6 +301,7 @@ def activate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ActivateApplicationPackageParameters') @@ -308,6 +312,7 @@ def activate( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.activate.metadata['url'], @@ -315,7 +320,11 @@ def activate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -329,7 +338,7 @@ def activate( return deserialized - activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate'} # type: ignore + activate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate"} # type: ignore @distributed_trace @@ -355,7 +364,7 @@ def create( :type application_name: str :param version_name: The version of the application. :type version_name: str - :param parameters: The parameters for the request. + :param parameters: The parameters for the request. Default value is None. :type parameters: ~azure.mgmt.batch.models.ApplicationPackage :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationPackage, or the result of cls(response) @@ -368,6 +377,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -381,6 +391,7 @@ def create( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -388,7 +399,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,11 +417,11 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -435,6 +450,8 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_delete_request( resource_group_name=resource_group_name, @@ -442,12 +459,17 @@ def delete( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -457,7 +479,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace @@ -490,6 +512,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -497,12 +521,17 @@ def get( application_name=application_name, version_name=version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,7 +545,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"} # type: ignore @distributed_trace @@ -536,7 +565,8 @@ def list( :type account_name: str :param application_name: The name of the application. This must be unique within the account. :type application_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -544,6 +574,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListApplicationPackagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListApplicationPackagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -557,6 +589,7 @@ def prepare_request(next_link=None): account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=self.list.metadata['url'], ) @@ -570,6 +603,7 @@ def prepare_request(next_link=None): account_name=account_name, application_name=application_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -588,7 +622,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,4 +639,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions"} # type: ignore 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 d649bee6d8dc..c184cb9ec99f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") # pylint: disable=line-too-long 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) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") # pylint: disable=line-too-long 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) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -191,29 +193,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts') + _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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,30 +226,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_synchronize_auto_storage_keys_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,35 +300,35 @@ def build_regenerate_key_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys") # pylint: disable=line-too-long 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) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -336,31 +341,32 @@ def build_get_keys_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -371,31 +377,32 @@ def build_list_detectors_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -407,10 +414,11 @@ def build_get_detector_request( detector_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -418,21 +426,21 @@ def build_get_detector_request( "detectorId": _SERIALIZER.url("detector_id", detector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -443,31 +451,32 @@ def build_list_outbound_network_dependencies_endpoints_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -506,6 +515,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountCreateParameters') @@ -514,6 +524,7 @@ def _create_initial( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], @@ -521,7 +532,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -543,7 +558,7 @@ def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace @@ -580,8 +595,9 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.BatchAccount] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -593,6 +609,7 @@ def begin_create( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -617,10 +634,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace def update( @@ -649,6 +665,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountUpdateParameters') @@ -657,6 +674,7 @@ def update( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -664,7 +682,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -678,10 +700,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -693,17 +715,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -719,11 +748,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -747,7 +776,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -758,6 +788,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -778,10 +809,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace def get( @@ -807,17 +837,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -831,7 +868,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"} # type: ignore @distributed_trace @@ -847,6 +884,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -857,6 +896,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -866,6 +906,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -883,7 +924,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -896,7 +941,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts"} # type: ignore @distributed_trace def list_by_resource_group( @@ -914,6 +959,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.BatchAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchAccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -925,6 +972,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -935,6 +983,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -952,7 +1001,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -965,10 +1018,10 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts"} # type: ignore @distributed_trace - def synchronize_auto_storage_keys( + def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -992,17 +1045,24 @@ def synchronize_auto_storage_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_synchronize_auto_storage_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.synchronize_auto_storage_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1012,7 +1072,7 @@ def synchronize_auto_storage_keys( if cls: return cls(pipeline_response, None, {}) - synchronize_auto_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'} # type: ignore + synchronize_auto_storage_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys"} # type: ignore @distributed_trace @@ -1047,6 +1107,7 @@ def regenerate_key( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BatchAccountRegenerateKeyParameters') @@ -1055,6 +1116,7 @@ def regenerate_key( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_key.metadata['url'], @@ -1062,7 +1124,11 @@ def regenerate_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1076,7 +1142,7 @@ def regenerate_key( return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'} # type: ignore + regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys"} # type: ignore @distributed_trace @@ -1108,17 +1174,24 @@ def get_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1132,7 +1205,7 @@ def get_keys( return deserialized - get_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'} # type: ignore + get_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys"} # type: ignore @distributed_trace @@ -1153,6 +1226,8 @@ def list_detectors( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.DetectorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DetectorListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1165,6 +1240,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, account_name=account_name, + api_version=api_version, template_url=self.list_detectors.metadata['url'], ) request = _convert_request(request) @@ -1176,6 +1252,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, account_name=account_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1193,7 +1270,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1206,7 +1287,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_detectors.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors'} # type: ignore + list_detectors.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors"} # type: ignore @distributed_trace def get_detector( @@ -1235,18 +1316,25 @@ def get_detector( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + 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, + api_version=api_version, 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1260,7 +1348,7 @@ def get_detector( return deserialized - get_detector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}'} # type: ignore + get_detector.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"} # type: ignore @distributed_trace @@ -1288,6 +1376,8 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1300,6 +1390,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], ) request = _convert_request(request) @@ -1311,6 +1402,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1328,7 +1420,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,4 +1437,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints'} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints"} # type: ignore 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 5c08d4507fe8..8791ce8f2bfa 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 from .._vendor import _convert_request, _format_url_section @@ -39,37 +39,38 @@ def build_list_by_batch_account_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates") # pylint: disable=line-too-long 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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,12 +87,12 @@ def build_create_request( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}") # pylint: disable=line-too-long 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]+$'), @@ -99,27 +100,27 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -137,12 +138,12 @@ def build_update_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}") # pylint: disable=line-too-long 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]+$'), @@ -150,25 +151,25 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -182,10 +183,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}") # pylint: disable=line-too-long 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]+$'), @@ -193,21 +195,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,10 +221,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}") # pylint: disable=line-too-long 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]+$'), @@ -230,21 +233,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -256,10 +259,11 @@ def build_cancel_deletion_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete") # pylint: disable=line-too-long 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]+$'), @@ -267,21 +271,21 @@ def build_cancel_deletion_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -323,14 +327,16 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param select: Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for - selection. + selection. Default value is None. :type select: str :param filter: OData filter expression. Valid properties for filtering are - "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". + "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". Default + value is None. :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 @@ -338,6 +344,8 @@ def list_by_batch_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListCertificatesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListCertificatesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -350,6 +358,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -364,6 +373,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -384,7 +394,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -397,7 +411,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates"} # type: ignore @distributed_trace def create( @@ -424,10 +438,10 @@ def create( :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters :param if_match: The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply the operation only if the certificate already exists. If omitted, this - operation will always be applied. + operation will always be applied. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new certificate to be created, but to prevent - updating an existing certificate. Other values will be ignored. + updating an existing certificate. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) @@ -440,6 +454,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') @@ -449,6 +464,7 @@ def create( account_name=account_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -458,7 +474,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -475,7 +495,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace @@ -501,7 +521,7 @@ def update( :param parameters: Certificate entity to update. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters :param if_match: The entity state (ETag) version of the certificate to update. This value can - be omitted or set to "*" to apply the operation unconditionally. + be omitted or set to "*" to apply the operation unconditionally. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate, or the result of cls(response) @@ -514,6 +534,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') @@ -523,6 +544,7 @@ def update( account_name=account_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -531,7 +553,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -548,10 +574,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -564,18 +590,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self._delete_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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -591,11 +624,11 @@ def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -624,7 +657,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -636,6 +670,7 @@ def begin_delete( resource_group_name=resource_group_name, account_name=account_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -656,10 +691,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace def get( @@ -690,18 +724,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -718,7 +759,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"} # type: ignore @distributed_trace @@ -757,18 +798,25 @@ def cancel_deletion( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.cancel_deletion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,5 +833,5 @@ def cancel_deletion( return deserialized - cancel_deletion.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete'} # type: ignore + 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 25678be252e2..09cd4e75ad51 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ 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 @@ -32,30 +32,31 @@ def build_get_quotas_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,34 +69,35 @@ def build_list_supported_virtual_machine_skus_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus") # pylint: disable=line-too-long 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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -108,34 +110,35 @@ def build_list_supported_cloud_service_skus_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus") # pylint: disable=line-too-long 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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -148,34 +151,34 @@ def build_check_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability") # pylint: disable=line-too-long 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) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -224,16 +227,23 @@ def get_quotas( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + request = build_get_quotas_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_quotas.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,7 +257,7 @@ def get_quotas( return deserialized - get_quotas.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas'} # type: ignore + get_quotas.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas"} # type: ignore @distributed_trace @@ -262,15 +272,19 @@ def list_supported_virtual_machine_skus( :param location_name: The region for which to retrieve Batch service supported SKUs. :type location_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param filter: OData filter expression. Valid properties for filtering are "familyName". + Default value is None. :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 SupportedSkusResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.SupportedSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -282,6 +296,7 @@ def prepare_request(next_link=None): request = build_list_supported_virtual_machine_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=self.list_supported_virtual_machine_skus.metadata['url'], @@ -294,6 +309,7 @@ def prepare_request(next_link=None): request = build_list_supported_virtual_machine_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=next_link, @@ -313,7 +329,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -326,7 +346,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_supported_virtual_machine_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus'} # type: ignore + 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( @@ -340,15 +360,19 @@ def list_supported_cloud_service_skus( :param location_name: The region for which to retrieve Batch service supported SKUs. :type location_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param filter: OData filter expression. Valid properties for filtering are "familyName". + Default value is None. :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 SupportedSkusResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.SupportedSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -360,6 +384,7 @@ def prepare_request(next_link=None): request = build_list_supported_cloud_service_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=self.list_supported_cloud_service_skus.metadata['url'], @@ -372,6 +397,7 @@ def prepare_request(next_link=None): request = build_list_supported_cloud_service_skus_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, filter=filter, template_url=next_link, @@ -391,7 +417,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -404,7 +434,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_supported_cloud_service_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus'} # type: ignore + list_supported_cloud_service_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus"} # type: ignore @distributed_trace def check_name_availability( @@ -430,6 +460,7 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') @@ -437,6 +468,7 @@ def check_name_availability( request = build_check_name_availability_request( location_name=location_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -444,7 +476,11 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,5 +494,5 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability'} # type: ignore + 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 8df807ca6ed0..59de7fee57a0 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ 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 @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Batch/operations') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -84,6 +85,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -93,6 +96,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -101,6 +105,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -118,7 +123,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,4 +140,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Batch/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Batch/operations"} # type: ignore 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 a5e45dca7bce..d41200a0f9a8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 from .._vendor import _convert_request, _format_url_section @@ -39,37 +39,38 @@ def build_list_by_batch_account_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools") # pylint: disable=line-too-long 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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if maxresults is not None: - query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,12 +87,12 @@ def build_create_request( if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}") # pylint: disable=line-too-long 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]+$'), @@ -99,27 +100,27 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -137,12 +138,12 @@ def build_update_request( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}") # pylint: disable=line-too-long 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]+$'), @@ -150,25 +151,25 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -182,10 +183,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}") # pylint: disable=line-too-long 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]+$'), @@ -193,21 +195,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,10 +221,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}") # pylint: disable=line-too-long 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]+$'), @@ -230,21 +233,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -256,10 +259,11 @@ def build_disable_auto_scale_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale") # pylint: disable=line-too-long 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]+$'), @@ -267,21 +271,21 @@ def build_disable_auto_scale_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -293,10 +297,11 @@ def build_stop_resize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize") # pylint: disable=line-too-long 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]+$'), @@ -304,21 +309,21 @@ def build_stop_resize_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -360,11 +365,12 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :type maxresults: int :param select: Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for - selection. + selection. Default value is None. :type select: str :param filter: OData filter expression. Valid properties for filtering are: @@ -378,13 +384,15 @@ def list_by_batch_account( properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale - properties/scaleSettings/fixedScale. + properties/scaleSettings/fixedScale. Default value is None. :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 ListPoolsResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPoolsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPoolsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -397,6 +405,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -411,6 +420,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, + api_version=api_version, maxresults=maxresults, select=select, filter=filter, @@ -431,7 +441,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -444,7 +458,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools"} # type: ignore @distributed_trace def create( @@ -469,10 +483,10 @@ def create( :type parameters: ~azure.mgmt.batch.models.Pool :param if_match: The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the operation only if the pool already exists. If omitted, this operation will - always be applied. + always be applied. Default value is None. :type if_match: str :param if_none_match: Set to '*' to allow a new pool to be created, but to prevent updating an - existing pool. Other values will be ignored. + existing pool. Other values will be ignored. Default value is None. :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Pool, or the result of cls(response) @@ -485,6 +499,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Pool') @@ -494,6 +509,7 @@ def create( account_name=account_name, pool_name=pool_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -503,7 +519,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -520,7 +540,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace @@ -545,7 +565,7 @@ def update( updated, any property not supplied will be unchanged. :type parameters: ~azure.mgmt.batch.models.Pool :param if_match: The entity state (ETag) version of the pool to update. This value can be - omitted or set to "*" to apply the operation unconditionally. + omitted or set to "*" to apply the operation unconditionally. Default value is None. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Pool, or the result of cls(response) @@ -558,6 +578,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Pool') @@ -567,6 +588,7 @@ def update( account_name=account_name, pool_name=pool_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -575,7 +597,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -592,10 +618,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -608,18 +634,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self._delete_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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -635,11 +668,11 @@ def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, @@ -666,7 +699,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -678,6 +712,7 @@ def begin_delete( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -698,10 +733,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace def get( @@ -730,18 +764,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -758,7 +799,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"} # type: ignore @distributed_trace @@ -788,18 +829,25 @@ def disable_auto_scale( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.disable_auto_scale.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,7 +864,7 @@ def disable_auto_scale( return deserialized - disable_auto_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale'} # type: ignore + disable_auto_scale.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale"} # type: ignore @distributed_trace @@ -853,18 +901,25 @@ def stop_resize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.stop_resize.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -881,5 +936,5 @@ def stop_resize( return deserialized - stop_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize'} # type: ignore + 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 dd0b11f03c26..a6200ff466b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 from .._vendor import _convert_request, _format_url_section @@ -37,33 +37,34 @@ def build_list_by_batch_account_request( maxresults: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "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) + _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') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -86,21 +88,21 @@ def build_get_request( "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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_update_request_initial( if_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str 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}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -129,30 +131,68 @@ def build_update_request_initial( "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) + _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') + _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 = kwargs.pop("headers", {}) # type: Dict[str, Any] if if_match is not None: - header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + class PrivateEndpointConnectionOperations(object): """PrivateEndpointConnectionOperations operations. @@ -189,7 +229,8 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -198,6 +239,8 @@ def list_by_batch_account( ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPrivateEndpointConnectionsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateEndpointConnectionsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -210,6 +253,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=self.list_by_batch_account.metadata['url'], ) @@ -222,6 +266,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -240,7 +285,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -253,7 +302,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( @@ -283,18 +332,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -308,7 +364,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _update_initial( @@ -326,6 +382,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -335,6 +392,7 @@ def _update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, if_match=if_match, @@ -343,7 +401,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -365,7 +427,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -391,7 +453,8 @@ def begin_update( are supplied will be updated, any property not supplied will be unchanged. :type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection :param if_match: The state (ETag) version of the private endpoint connection to update. This - value can be omitted or set to "*" to apply the operation unconditionally. + value can be omitted or set to "*" to apply the operation unconditionally. Default value is + None. :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. @@ -406,8 +469,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.batch.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,6 +485,7 @@ def begin_update( private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, if_match=if_match, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -445,7 +510,123 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_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 = kwargs.pop('api_version', "2022-06-01") # type: str + + + request = build_delete_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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + 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}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private endpoint connection. + + :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 private_endpoint_connection_name: The private endpoint connection name. This must be + unique within the account. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.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 8e3d15504ab7..51e8c9d7d567 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ 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 @@ -34,33 +34,34 @@ def build_list_by_batch_account_request( maxresults: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "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) + _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') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_get_request( private_link_resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -83,21 +85,21 @@ def build_get_request( "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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -137,7 +139,8 @@ def list_by_batch_account( :type resource_group_name: str :param account_name: The name of the Batch account. :type account_name: str - :param maxresults: The maximum number of items to return in the response. + :param maxresults: The maximum number of items to return in the response. Default value is + None. :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 @@ -145,6 +148,8 @@ def list_by_batch_account( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.batch.models.ListPrivateLinkResourcesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPrivateLinkResourcesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -157,6 +162,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=self.list_by_batch_account.metadata['url'], ) @@ -169,6 +175,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, account_name=account_name, + api_version=api_version, maxresults=maxresults, template_url=next_link, ) @@ -187,7 +194,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -200,7 +211,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_batch_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources'} # type: ignore + list_by_batch_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources"} # type: ignore @distributed_trace def get( @@ -230,18 +241,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-06-01") # type: 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, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,5 +273,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}"} # type: ignore