From 5cd5c3a5c14645a744b7cc64f8f372bb2ec5f4c7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 7 Jun 2023 05:29:27 +0000 Subject: [PATCH] CodeGen from PR 24163 in Azure/azure-rest-api-specs Merge 4a2e07c9ee2560197b24c83f770ac63b917b85a1 into 6c6b16dc98d720304633b76c8e82c282ffa9cc08 --- sdk/batch/azure-mgmt-batch/_meta.json | 6 +- .../azure/mgmt/batch/__init__.py | 2 +- .../mgmt/batch/_batch_management_client.py | 17 +- .../azure/mgmt/batch/_configuration.py | 15 +- .../azure/mgmt/batch/_serialization.py | 180 ++++--- .../azure/mgmt/batch/_vendor.py | 5 +- .../azure/mgmt/batch/_version.py | 2 +- .../azure/mgmt/batch/aio/__init__.py | 2 +- .../batch/aio/_batch_management_client.py | 10 +- .../azure/mgmt/batch/aio/_configuration.py | 10 +- .../mgmt/batch/aio/operations/__init__.py | 2 +- .../aio/operations/_application_operations.py | 109 ++-- .../_application_package_operations.py | 111 +++-- .../operations/_batch_account_operations.py | 292 +++++------ .../aio/operations/_certificate_operations.py | 147 +++--- .../aio/operations/_location_operations.py | 90 ++-- .../mgmt/batch/aio/operations/_operations.py | 24 +- .../batch/aio/operations/_pool_operations.py | 163 +++--- ..._private_endpoint_connection_operations.py | 130 ++--- .../_private_link_resource_operations.py | 43 +- .../azure/mgmt/batch/models/__init__.py | 4 +- .../models/_batch_management_client_enums.py | 265 +++++----- .../azure/mgmt/batch/models/_models_py3.py | 469 +++++++++++------- .../azure/mgmt/batch/operations/__init__.py | 2 +- .../operations/_application_operations.py | 133 ++--- .../_application_package_operations.py | 135 ++--- .../operations/_batch_account_operations.py | 346 ++++++------- .../operations/_certificate_operations.py | 175 +++---- .../batch/operations/_location_operations.py | 108 ++-- .../mgmt/batch/operations/_operations.py | 26 +- .../mgmt/batch/operations/_pool_operations.py | 195 ++++---- ..._private_endpoint_connection_operations.py | 148 +++--- .../_private_link_resource_operations.py | 51 +- .../generated_samples/application_create.py | 2 +- .../generated_samples/application_delete.py | 5 +- .../generated_samples/application_get.py | 2 +- .../generated_samples/application_list.py | 2 +- .../application_package_activate.py | 2 +- .../application_package_create.py | 2 +- .../application_package_delete.py | 5 +- .../application_package_get.py | 2 +- .../application_package_list.py | 2 +- .../generated_samples/application_update.py | 2 +- .../batch_account_create_byos.py | 2 +- .../batch_account_create_default.py | 2 +- ...account_create_system_assigned_identity.py | 2 +- ...h_account_create_user_assigned_identity.py | 2 +- .../generated_samples/batch_account_delete.py | 5 +- .../generated_samples/batch_account_get.py | 2 +- .../batch_account_get_keys.py | 2 +- .../generated_samples/batch_account_list.py | 2 +- .../batch_account_list_by_resource_group.py | 2 +- ...utbound_network_dependencies_endpoints.py} | 4 +- .../batch_account_regenerate_key.py | 2 +- ...h_account_synchronize_auto_storage_keys.py | 5 +- .../generated_samples/batch_account_update.py | 2 +- .../certificate_cancel_deletion.py | 2 +- ...te__full.py => certificate_create_full.py} | 4 +- ...l_pfx.py => certificate_create_minimal.py} | 4 +- ...r.py => certificate_create_minimal_cer.py} | 4 +- .../generated_samples/certificate_delete.py | 5 +- ...{get_certificate.py => certificate_get.py} | 4 +- ...=> certificate_get_with_deletion_error.py} | 4 +- ...st_certificates.py => certificate_list.py} | 4 +- ...ect.py => certificate_list_with_filter.py} | 4 +- ...e_certificate.py => certificate_update.py} | 4 +- .../{get_detector.py => detector_get.py} | 4 +- .../{list_detectors.py => detector_list.py} | 4 +- ..._check_name_availability_already_exists.py | 2 +- ...ation_check_name_availability_available.py | 2 +- .../generated_samples/location_get_quotas.py | 2 +- .../location_list_cloud_service_skus.py | 2 +- .../location_list_virtual_machine_skus.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../pool_create_accelerated_networking.py | 63 +++ ...ool_create_cloud_service_configuration.py} | 4 +- ...te_minimal_cloud_service_configuration.py} | 4 +- ..._minimal_virtual_machine_configuration.py} | 4 +- ... => pool_create_no_public_ip_addresses.py} | 4 +- ...ublic_ips.py => pool_create_public_ips.py} | 4 +- ...py => pool_create_shared_image_gallery.py} | 4 +- ...> pool_create_user_assigned_identities.py} | 4 +- ...l_create_virtual_machine_configuration.py} | 4 +- ...rtual_machine_configuration_extensions.py} | 17 +- .../{delete_pool.py => pool_delete.py} | 7 +- ...to_scale.py => pool_disable_auto_scale.py} | 4 +- .../{get_pool.py => pool_get.py} | 4 +- .../pool_get_accelerated_networking.py | 42 ++ ...rtual_machine_configuration_extensions.py} | 4 +- .../{list_pool.py => pool_list.py} | 4 +- ...ith_filter.py => pool_list_with_filter.py} | 4 +- ...top_pool_resize.py => pool_stop_resize.py} | 4 +- ...le.py => pool_update_enable_auto_scale.py} | 4 +- ...ies.py => pool_update_other_properties.py} | 4 +- ...sk.py => pool_update_remove_start_task.py} | 4 +- ...ize_pool.py => pool_update_resize_pool.py} | 4 +- .../private_batch_account_create.py | 2 +- .../private_batch_account_get.py | 2 +- .../private_endpoint_connection_delete.py | 5 +- ....py => private_endpoint_connection_get.py} | 4 +- ... => private_endpoint_connection_update.py} | 4 +- ...y => private_endpoint_connections_list.py} | 4 +- ...source.py => private_link_resource_get.py} | 4 +- ...urce.py => private_link_resources_list.py} | 4 +- 104 files changed, 1996 insertions(+), 1770 deletions(-) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_outbound_network_dependencies.py => batch_account_list_outbound_network_dependencies_endpoints.py} (91%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_certificate__full.py => certificate_create_full.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_certificate__minimal_pfx.py => certificate_create_minimal.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_certificate__minimal_cer.py => certificate_create_minimal_cer.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_certificate.py => certificate_get.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_certificate_with_deletion_error.py => certificate_get_with_deletion_error.py} (92%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_certificates.py => certificate_list.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_certificates__filter_and_select.py => certificate_list_with_filter.py} (92%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_certificate.py => certificate_update.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_detector.py => detector_get.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_detectors.py => detector_list.py} (94%) create mode 100644 sdk/batch/azure-mgmt-batch/generated_samples/pool_create_accelerated_networking.py rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__full_cloud_service_configuration.py => pool_create_cloud_service_configuration.py} (97%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__minimal_cloud_service_configuration.py => pool_create_minimal_cloud_service_configuration.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__minimal_virtual_machine_configuration.py => pool_create_minimal_virtual_machine_configuration.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__no_public_ip.py => pool_create_no_public_ip_addresses.py} (95%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__public_ips.py => pool_create_public_ips.py} (96%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__custom_image.py => pool_create_shared_image_gallery.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__user_assigned_identities.py => pool_create_user_assigned_identities.py} (95%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__full_virtual_machine_configuration.py => pool_create_virtual_machine_configuration.py} (97%) rename sdk/batch/azure-mgmt-batch/generated_samples/{create_pool__virtual_machine_configuration_extensions.py => pool_create_virtual_machine_configuration_extensions.py} (78%) rename sdk/batch/azure-mgmt-batch/generated_samples/{delete_pool.py => pool_delete.py} (90%) rename sdk/batch/azure-mgmt-batch/generated_samples/{disable_auto_scale.py => pool_disable_auto_scale.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_pool.py => pool_get.py} (95%) create mode 100644 sdk/batch/azure-mgmt-batch/generated_samples/pool_get_accelerated_networking.py rename sdk/batch/azure-mgmt-batch/generated_samples/{get_pool__virtual_machine_configuration_extensions.py => pool_get_virtual_machine_configuration_extensions.py} (91%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_pool.py => pool_list.py} (95%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_pool_with_filter.py => pool_list_with_filter.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{stop_pool_resize.py => pool_stop_resize.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_pool__enable_autoscale.py => pool_update_enable_auto_scale.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_pool__other_properties.py => pool_update_other_properties.py} (96%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_pool__remove_start_task.py => pool_update_remove_start_task.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_pool__resize_pool.py => pool_update_resize_pool.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_private_endpoint_connection.py => private_endpoint_connection_get.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{update_private_endpoint_connection.py => private_endpoint_connection_update.py} (94%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_private_endpoint_connections.py => private_endpoint_connections_list.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{get_private_link_resource.py => private_link_resource_get.py} (93%) rename sdk/batch/azure-mgmt-batch/generated_samples/{list_private_link_resource.py => private_link_resources_list.py} (93%) diff --git a/sdk/batch/azure-mgmt-batch/_meta.json b/sdk/batch/azure-mgmt-batch/_meta.json index 959214710b32..d3f78ede6247 100644 --- a/sdk/batch/azure-mgmt-batch/_meta.json +++ b/sdk/batch/azure-mgmt-batch/_meta.json @@ -1,11 +1,11 @@ { - "commit": "fc3c409825d6a31ba909a88ea34dcc13165edc9c", + "commit": "d6674842aa92b35ab3411008d8656e4e5dc0e066", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.5.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/batch/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/batch/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.5.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/batch/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py index 8bc8749db5e0..fd0e2d493c6c 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_batch_management_client.py index 3a50c8e8c354..6aba7bd45082 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 @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import BatchManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -61,7 +61,7 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -78,9 +78,9 @@ def __init__( self._config = BatchManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -122,15 +122,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> BatchManagementClient + def __enter__(self) -> "BatchManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 3ec69b883c57..30202cff4c88 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,14 +30,14 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(BatchManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-batch/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_serialization.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_serialization.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) 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 55d872662d03..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 = "17.0.0" +VERSION = "14.0.0b1" diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py index cd7e0aa0cf4e..483d9240d9df 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/_batch_management_client.py index c35cc68b6068..9dfc903d2e69 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 @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import BatchManagementClientConfiguration from .operations import ( @@ -61,7 +61,7 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -78,9 +78,9 @@ def __init__( self._config = BatchManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -129,5 +129,5 @@ async def __aenter__(self) -> "BatchManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 1fee99a327ec..a6d8dbfa4a16 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,14 +30,14 @@ class BatchManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(BatchManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/__init__.py index 484efa0258a1..ec302145381b 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/aio/operations/__init__.py @@ -17,7 +17,7 @@ from ._pool_operations import PoolOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ 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 16ef24cbee36..c05d862a390b 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -147,8 +143,8 @@ async def create( :param application_name: The name of the application. This must be unique within the account. Required. :type application_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. Default - value is None. + :param parameters: The parameters for the request. Is either a Application type or a IO type. + Default value is None. :type parameters: ~azure.mgmt.batch.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -169,16 +165,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -200,10 +194,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +214,9 @@ 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}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -251,10 +248,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -267,10 +262,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +278,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace_async async def get( @@ -314,10 +312,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -330,10 +326,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,7 +346,9 @@ 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}" + } @overload async def update( @@ -434,7 +433,7 @@ async def update( :param application_name: The name of the application. This must be unique within the account. Required. :type application_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. + :param parameters: The parameters for the request. Is either a Application type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -456,16 +455,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Application") @@ -484,10 +481,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,7 +501,9 @@ 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}" + } @distributed_trace def list( @@ -527,10 +527,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListApplicationsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListApplicationsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -554,7 +552,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -570,7 +568,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -578,14 +576,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListApplicationsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,4 +596,6 @@ 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" + } 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 0c3708764c60..f0f72994dfa8 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -162,8 +158,8 @@ async def activate( :type application_name: str :param version_name: The version of the application. Required. :type version_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. - Required. + :param parameters: The parameters for the request. Is either a + ActivateApplicationPackageParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -184,16 +180,14 @@ async def activate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ActivateApplicationPackageParameters") @@ -213,10 +207,11 @@ async def activate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,7 +227,9 @@ 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" + } @overload async def create( @@ -335,8 +332,8 @@ async def create( :type application_name: str :param version_name: The version of the application. Required. :type version_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. Default - value is None. + :param parameters: The parameters for the request. Is either a ApplicationPackage type or a IO + type. Default value is None. :type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -357,16 +354,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -389,10 +384,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -408,7 +404,9 @@ 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}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -442,10 +440,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -459,10 +455,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -474,7 +471,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace_async async def get( @@ -508,10 +507,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -525,10 +522,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +542,9 @@ 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}" + } @distributed_trace def list( @@ -576,10 +576,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListApplicationPackagesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListApplicationPackagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -604,7 +602,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -620,7 +618,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -628,14 +626,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,4 +646,6 @@ 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" + } 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 bb20adde4058..499709b7474b 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -46,10 +46,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,16 +87,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BatchAccount]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BatchAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountCreateParameters") @@ -118,10 +112,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,7 +139,9 @@ 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}" + } @overload async def begin_create( @@ -248,8 +245,8 @@ async def begin_create( service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. Required. :type account_name: str - :param parameters: Additional parameters for account creation. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for account creation. Is either a + BatchAccountCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -270,16 +267,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -299,9 +294,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -313,9 +308,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @overload async def update( @@ -388,8 +385,8 @@ async def update( :type resource_group_name: str :param account_name: The name of the Batch account. Required. :type account_name: str - :param parameters: Additional parameters for account update. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for account update. Is either a + BatchAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -410,16 +407,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountUpdateParameters") @@ -437,10 +432,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -456,7 +452,9 @@ 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -472,10 +470,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -487,10 +483,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,7 +504,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -533,13 +532,11 @@ async def begin_delete(self, resource_group_name: str, account_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -557,9 +554,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -571,9 +568,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.BatchAccount: @@ -600,10 +599,8 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -615,10 +612,11 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,7 +632,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) 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}" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.BatchAccount"]: @@ -648,10 +648,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.BatchAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -672,7 +670,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -688,7 +686,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -696,14 +694,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -715,7 +714,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"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.BatchAccount"]: @@ -732,10 +731,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -757,7 +754,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -773,7 +770,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -781,14 +778,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -800,7 +798,9 @@ 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" + } @distributed_trace_async async def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statements @@ -830,10 +830,8 @@ async def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_synchronize_auto_storage_keys_request( resource_group_name=resource_group_name, @@ -845,10 +843,11 @@ async def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return- params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -860,7 +859,9 @@ async def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return- 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" + } @overload async def regenerate_key( @@ -948,8 +949,8 @@ async def regenerate_key( :type resource_group_name: str :param account_name: The name of the Batch account. Required. :type account_name: str - :param parameters: The type of key to regenerate. Is either a model type or a IO type. - Required. + :param parameters: The type of key to regenerate. Is either a + BatchAccountRegenerateKeyParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountRegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -970,16 +971,14 @@ async def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountRegenerateKeyParameters") @@ -997,10 +996,11 @@ async def regenerate_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1016,7 +1016,9 @@ 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" + } @distributed_trace_async async def get_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.BatchAccountKeys: @@ -1048,10 +1050,8 @@ async def get_keys(self, resource_group_name: str, account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountKeys] = kwargs.pop("cls", None) request = build_get_keys_request( resource_group_name=resource_group_name, @@ -1063,10 +1063,11 @@ async def get_keys(self, resource_group_name: str, account_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1083,9 @@ async def get_keys(self, resource_group_name: str, account_name: str, **kwargs: 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" + } @distributed_trace def list_detectors( @@ -1103,10 +1106,8 @@ def list_detectors( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DetectorListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DetectorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1129,7 +1130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1145,7 +1146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1153,14 +1154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DetectorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1172,7 +1174,9 @@ 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" + } @distributed_trace_async async def get_detector( @@ -1203,10 +1207,8 @@ async def get_detector( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DetectorResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DetectorResponse] = kwargs.pop("cls", None) request = build_get_detector_request( resource_group_name=resource_group_name, @@ -1219,10 +1221,11 @@ async def get_detector( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1238,7 +1241,9 @@ 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}" + } @distributed_trace def list_outbound_network_dependencies_endpoints( @@ -1266,10 +1271,8 @@ def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1292,7 +1295,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1308,7 +1311,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1316,14 +1319,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1335,4 +1339,6 @@ 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" + } 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 58a4d76750e2..0c1f1b1aeb77 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -107,10 +103,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListCertificatesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCertificatesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +130,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +146,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,14 +154,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListCertificatesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +174,9 @@ 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" + } @overload async def create( @@ -299,8 +296,8 @@ async def create( and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. Required. :type certificate_name: str - :param parameters: Additional parameters for certificate creation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters for certificate creation. Is either a + CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO :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 @@ -328,16 +325,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -358,10 +353,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -380,7 +376,9 @@ 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}" + } @overload async def update( @@ -489,7 +487,8 @@ async def update( and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. Required. :type certificate_name: str - :param parameters: Certificate entity to update. Is either a model type or a IO type. Required. + :param parameters: Certificate entity to update. Is either a + CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO :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. Default value is None. @@ -513,16 +512,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -542,10 +539,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -564,7 +562,9 @@ 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, certificate_name: str, **kwargs: Any @@ -580,10 +580,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -596,10 +594,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,7 +615,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace_async async def begin_delete( @@ -652,13 +653,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -677,9 +676,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -691,9 +690,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace_async async def get( @@ -730,10 +731,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -746,10 +745,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -768,7 +768,9 @@ 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}" + } @distributed_trace_async async def cancel_deletion( @@ -812,10 +814,8 @@ async def cancel_deletion( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_cancel_deletion_request( resource_group_name=resource_group_name, @@ -828,10 +828,11 @@ async def cancel_deletion( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -850,4 +851,6 @@ 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" + } 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 3e6fc89ac623..5e9ede4a392e 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_supported_virtual_machine_skus_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,10 +81,8 @@ async def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchLocationQuota] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchLocationQuota] = kwargs.pop("cls", None) request = build_get_quotas_request( location_name=location_name, @@ -99,10 +93,11 @@ async def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -118,7 +113,9 @@ async def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLo 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" + } @distributed_trace def list_supported_virtual_machine_skus( @@ -142,10 +139,8 @@ def list_supported_virtual_machine_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -169,7 +164,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -185,7 +180,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -193,14 +188,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,7 +208,9 @@ 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" + } @distributed_trace def list_supported_cloud_service_skus( @@ -236,10 +234,8 @@ def list_supported_cloud_service_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -263,7 +259,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -279,7 +275,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -287,14 +283,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,7 +303,9 @@ 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" + } @overload async def check_name_availability( @@ -359,8 +358,8 @@ async def check_name_availability( :param location_name: The desired region for the name check. Required. :type location_name: str - :param parameters: Properties needed to check the availability of a name. Is either a model - type or a IO type. Required. + :param parameters: Properties needed to check the availability of a name. Is either a + CheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -381,16 +380,14 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") @@ -407,10 +404,11 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -426,4 +424,6 @@ 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" + } 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 9b6e6b42996e..a5cedd2ba031 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +64,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +85,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +101,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,14 +109,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,4 +129,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"} 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 3337d742227c..bb05c3c5cae9 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,10 +110,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPoolsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPoolsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -143,7 +137,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -159,7 +153,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -167,14 +161,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListPoolsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,7 +181,9 @@ 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" + } @overload async def create( @@ -288,8 +285,8 @@ async def create( :type account_name: str :param pool_name: The pool name. This must be unique within the account. Required. :type pool_name: str - :param parameters: Additional parameters for pool creation. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for pool creation. Is either a Pool type or a IO type. + Required. :type parameters: ~azure.mgmt.batch.models.Pool or IO :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 @@ -317,16 +314,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Pool") @@ -347,10 +342,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,7 +365,9 @@ 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}" + } @overload async def update( @@ -463,7 +461,7 @@ async def update( :param pool_name: The pool name. This must be unique within the account. Required. :type pool_name: str :param parameters: Pool properties that should be updated. Properties that are supplied will be - updated, any property not supplied will be unchanged. Is either a model type or a IO type. + updated, any property not supplied will be unchanged. Is either a Pool type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.Pool or IO :param if_match: The entity state (ETag) version of the pool to update. This value can be @@ -488,16 +486,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Pool") @@ -517,10 +513,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,7 +536,9 @@ 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any @@ -555,10 +554,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -571,10 +568,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,7 +589,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace_async async def begin_delete( @@ -621,13 +621,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -646,9 +644,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -660,9 +658,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: @@ -691,10 +691,8 @@ async def get(self, resource_group_name: str, account_name: str, pool_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -707,10 +705,11 @@ async def get(self, resource_group_name: str, account_name: str, pool_name: str, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -729,7 +728,9 @@ async def get(self, resource_group_name: str, account_name: str, pool_name: str, 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}" + } @distributed_trace_async async def disable_auto_scale( @@ -760,10 +761,8 @@ async def disable_auto_scale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_disable_auto_scale_request( resource_group_name=resource_group_name, @@ -776,10 +775,11 @@ async def disable_auto_scale( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,7 +798,9 @@ 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" + } @distributed_trace_async async def stop_resize( @@ -836,10 +838,8 @@ async def stop_resize( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_stop_resize_request( resource_group_name=resource_group_name, @@ -852,10 +852,11 @@ async def stop_resize( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -874,4 +875,6 @@ 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" + } 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 633fea39bc38..a5edb533b068 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,10 +85,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPrivateEndpointConnectionsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPrivateEndpointConnectionsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +126,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,14 +134,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,7 +154,9 @@ 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" + } @distributed_trace_async async def get( @@ -191,10 +188,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -207,10 +202,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,7 +222,9 @@ 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}" + } async def _update_initial( self, @@ -248,16 +246,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -277,10 +273,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,7 +300,9 @@ 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}" + } @overload async def begin_update( @@ -418,8 +417,8 @@ async def begin_update( unique within the account. Required. :type private_endpoint_connection_name: str :param parameters: PrivateEndpointConnection properties that should be updated. Properties that - are supplied will be updated, any property not supplied will be unchanged. Is either a model - type or a IO type. Required. + are supplied will be updated, any property not supplied will be unchanged. Is either a + PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO :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. Default value is @@ -444,16 +443,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -475,10 +472,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -490,9 +487,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -508,10 +507,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -524,10 +521,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -544,7 +542,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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 + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -575,13 +575,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -600,10 +598,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -615,6 +613,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.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}" + } 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 2b417daeafa6..08f9608a44cb 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._private_link_resource_operations import build_get_request, build_list_by_batch_account_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,10 +75,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPrivateLinkResourcesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,7 +144,9 @@ 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" + } @distributed_trace_async async def get( @@ -182,10 +178,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -198,10 +192,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,4 +212,6 @@ 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}" + } 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 41cf71a645f3..5e0cee5e6bb3 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 @@ -119,6 +119,7 @@ from ._batch_management_client_enums import CertificateVisibility from ._batch_management_client_enums import ComputeNodeDeallocationOption from ._batch_management_client_enums import ComputeNodeFillType +from ._batch_management_client_enums import ContainerType from ._batch_management_client_enums import ContainerWorkingDirectory from ._batch_management_client_enums import DiskEncryptionTarget from ._batch_management_client_enums import DynamicVNetAssignmentScope @@ -144,7 +145,7 @@ from ._batch_management_client_enums import ResourceIdentityType from ._batch_management_client_enums import StorageAccountType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -260,6 +261,7 @@ "CertificateVisibility", "ComputeNodeDeallocationOption", "ComputeNodeFillType", + "ContainerType", "ContainerWorkingDirectory", "DiskEncryptionTarget", "DynamicVNetAssignmentScope", 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 ea1809b7ae1e..d163ce1ccb2a 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 @@ -13,45 +13,45 @@ class AccountKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of account key to regenerate.""" - #: The primary account key. PRIMARY = "Primary" - #: The secondary account key. + """The primary account key.""" SECONDARY = "Secondary" + """The secondary account key.""" class AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether the pool is resizing.""" - #: The pool is not resizing. There are no changes to the number of nodes in the pool in progress. - #: A pool enters this state when it is created and when no operations are being performed on the - #: pool to change the number of nodes. STEADY = "Steady" - #: The pool is resizing; that is, compute nodes are being added to or removed from the pool. + """The pool is not resizing. There are no changes to the number of nodes in the pool in progress. + #: A pool enters this state when it is created and when no operations are being performed on the + #: pool to change the number of nodes.""" RESIZING = "Resizing" - #: The pool was resizing, but the user has requested that the resize be stopped, but the stop - #: request has not yet been completed. + """The pool is resizing; that is, compute nodes are being added to or removed from the pool.""" STOPPING = "Stopping" + """The pool was resizing, but the user has requested that the resize be stopped, but the stop + #: request has not yet been completed.""" class AuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The authentication mode for the Batch account.""" - #: The authentication mode using shared keys. SHARED_KEY = "SharedKey" - #: The authentication mode using Azure Active Directory. + """The authentication mode using shared keys.""" AAD = "AAD" - #: The authentication mode using task authentication tokens. + """The authentication mode using Azure Active Directory.""" TASK_AUTHENTICATION_TOKEN = "TaskAuthenticationToken" + """The authentication mode using task authentication tokens.""" class AutoStorageAuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The authentication mode which the Batch service will use to manage the auto-storage account.""" - #: The Batch service will authenticate requests to auto-storage using storage account keys. STORAGE_KEYS = "StorageKeys" - #: The Batch service will authenticate requests to auto-storage using the managed identity - #: assigned to the Batch account. + """The Batch service will authenticate requests to auto-storage using storage account keys.""" BATCH_ACCOUNT_MANAGED_IDENTITY = "BatchAccountManagedIdentity" + """The Batch service will authenticate requests to auto-storage using the managed identity + #: assigned to the Batch account.""" class AutoUserScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -61,48 +61,48 @@ class AutoUserScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): which should not be accessible by normal tasks but should be accessible by start tasks. """ - #: Specifies that the service should create a new user for the task. TASK = "Task" - #: Specifies that the task runs as the common auto user account which is created on every node in - #: a pool. + """Specifies that the service should create a new user for the task.""" POOL = "Pool" + """Specifies that the task runs as the common auto user account which is created on every node in + #: a pool.""" class CachingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of caching to enable for the disk.""" - #: The caching mode for the disk is not enabled. NONE = "None" - #: The caching mode for the disk is read only. + """The caching mode for the disk is not enabled.""" READ_ONLY = "ReadOnly" - #: The caching mode for the disk is read and write. + """The caching mode for the disk is read only.""" READ_WRITE = "ReadWrite" + """The caching mode for the disk is read and write.""" class CertificateFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx.""" - #: The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. PFX = "Pfx" - #: The certificate is a base64-encoded X.509 certificate. + """The certificate is a PFX (PKCS#12) formatted certificate or certificate chain.""" CER = "Cer" + """The certificate is a base64-encoded X.509 certificate.""" class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CertificateProvisioningState.""" - #: The certificate is available for use in pools. SUCCEEDED = "Succeeded" - #: The user has requested that the certificate be deleted, but the delete operation has not yet - #: completed. You may not reference the certificate when creating or updating pools. + """The certificate is available for use in pools.""" DELETING = "Deleting" - #: The user requested that the certificate be deleted, but there are pools that still have + """The user has requested that the certificate be deleted, but the delete operation has not yet + #: completed. You may not reference the certificate when creating or updating pools.""" + FAILED = "Failed" + """The user requested that the certificate be deleted, but there are pools that still have #: references to the certificate, or it is still installed on one or more compute nodes. (The #: latter can occur if the certificate has been removed from the pool, but the node has not yet #: restarted. Nodes refresh their certificates only when they restart.) You may use the cancel #: certificate delete operation to cancel the delete, or the delete certificate operation to retry - #: the delete. - FAILED = "Failed" + #: the delete.""" class CertificateStoreLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -115,24 +115,24 @@ class CertificateStoreLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. """ - #: Certificates should be installed to the CurrentUser certificate store. CURRENT_USER = "CurrentUser" - #: Certificates should be installed to the LocalMachine certificate store. + """Certificates should be installed to the CurrentUser certificate store.""" LOCAL_MACHINE = "LocalMachine" + """Certificates should be installed to the LocalMachine certificate store.""" class CertificateVisibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CertificateVisibility.""" - #: The certificate should be visible to the user account under which the start task is run. Note - #: that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be - #: visible to the Task as well. START_TASK = "StartTask" - #: The certificate should be visible to the user accounts under which job tasks are run. + """The certificate should be visible to the user account under which the start task is run. Note + #: that if AutoUser Scope is Pool for both the StartTask and a Task, this certificate will be + #: visible to the Task as well.""" TASK = "Task" - #: The certificate should be visible to the user accounts under which users remotely access the - #: node. + """The certificate should be visible to the user accounts under which job tasks are run.""" REMOTE_USER = "RemoteUser" + """The certificate should be visible to the user accounts under which users remotely access the + #: node.""" class ComputeNodeDeallocationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -140,29 +140,38 @@ class ComputeNodeDeallocationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta deallocation. """ - #: Terminate running task processes and requeue the tasks. The tasks will run again when a node is - #: available. Remove nodes as soon as tasks have been terminated. REQUEUE = "Requeue" - #: Terminate running tasks. The tasks will be completed with failureInfo indicating that they were - #: terminated, and will not run again. Remove nodes as soon as tasks have been terminated. + """Terminate running task processes and requeue the tasks. The tasks will run again when a node is + #: available. Remove nodes as soon as tasks have been terminated.""" TERMINATE = "Terminate" - #: Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove nodes - #: when all tasks have completed. + """Terminate running tasks. The tasks will be completed with failureInfo indicating that they were + #: terminated, and will not run again. Remove nodes as soon as tasks have been terminated.""" TASK_COMPLETION = "TaskCompletion" - #: Allow currently running tasks to complete, then wait for all task data retention periods to - #: expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have - #: expired. + """Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove nodes + #: when all tasks have completed.""" RETAINED_DATA = "RetainedData" + """Allow currently running tasks to complete, then wait for all task data retention periods to + #: expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have + #: expired.""" class ComputeNodeFillType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """How tasks should be distributed across compute nodes.""" - #: Tasks should be assigned evenly across all nodes in the pool. SPREAD = "Spread" - #: As many tasks as possible (taskSlotsPerNode) should be assigned to each node in the pool before - #: any tasks are assigned to the next node in the pool. + """Tasks should be assigned evenly across all nodes in the pool.""" PACK = "Pack" + """As many tasks as possible (taskSlotsPerNode) should be assigned to each node in the pool before + #: any tasks are assigned to the next node in the pool.""" + + +class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The container technology to be used.""" + + DOCKER_COMPATIBLE = "DockerCompatible" + """A Docker compatible container technology will be used to launch the containers.""" + CRI_COMPATIBLE = "CriCompatible" + """A CRI based technology will be used to launch the containers.""" class ContainerWorkingDirectory(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -170,59 +179,59 @@ class ContainerWorkingDirectory(str, Enum, metaclass=CaseInsensitiveEnumMeta): 'taskWorkingDirectory'. """ - #: Use the standard Batch service task working directory, which will contain the Task resource - #: files populated by Batch. TASK_WORKING_DIRECTORY = "TaskWorkingDirectory" - #: Using container image defined working directory. Beware that this directory will not contain - #: the resource files downloaded by Batch. + """Use the standard Batch service task working directory, which will contain the Task resource + #: files populated by Batch.""" CONTAINER_IMAGE_DEFAULT = "ContainerImageDefault" + """Using container image defined working directory. Beware that this directory will not contain + #: the resource files downloaded by Batch.""" class DiskEncryptionTarget(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If omitted, no disks on the compute nodes in the pool will be encrypted.""" - #: The OS Disk on the compute node is encrypted. OS_DISK = "OsDisk" - #: The temporary disk on the compute node is encrypted. On Linux this encryption applies to other - #: partitions (such as those on mounted data disks) when encryption occurs at boot time. + """The OS Disk on the compute node is encrypted.""" TEMPORARY_DISK = "TemporaryDisk" + """The temporary disk on the compute node is encrypted. On Linux this encryption applies to other + #: partitions (such as those on mounted data disks) when encryption occurs at boot time.""" class DynamicVNetAssignmentScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The scope of dynamic vnet assignment.""" - #: No dynamic VNet assignment is enabled. NONE = "none" - #: 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 + """No dynamic VNet assignment is enabled.""" JOB = "job" + """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""" class ElevationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elevation level of the user.""" - #: The user is a standard user without elevated access. NON_ADMIN = "NonAdmin" - #: The user is a user with elevated access and operates with full Administrator permissions. + """The user is a standard user without elevated access.""" ADMIN = "Admin" + """The user is a user with elevated access and operates with full Administrator permissions.""" class EndpointAccessDefaultAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled.""" - #: Allow client access. ALLOW = "Allow" - #: Deny client access. + """Allow client access.""" DENY = "Deny" + """Deny client access.""" class InboundEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The protocol of the endpoint.""" - #: Use TCP for the endpoint. TCP = "TCP" - #: Use UDP for the endpoint. + """Use TCP for the endpoint.""" UDP = "UDP" + """Use UDP for the endpoint.""" class InterNodeCommunicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -231,33 +240,33 @@ class InterNodeCommunicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): specified, this value defaults to 'Disabled'. """ - #: Enable network communication between virtual machines. ENABLED = "Enabled" - #: Disable network communication between virtual machines. + """Enable network communication between virtual machines.""" DISABLED = "Disabled" + """Disable network communication between virtual machines.""" class IPAddressProvisioningType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning type for Public IP Addresses for the Batch Pool.""" - #: A public IP will be created and managed by Batch. There may be multiple public IPs depending on - #: the size of the Pool. BATCH_MANAGED = "BatchManaged" - #: Public IPs are provided by the user and will be used to provision the Compute Nodes. + """A public IP will be created and managed by Batch. There may be multiple public IPs depending on + #: the size of the Pool.""" USER_MANAGED = "UserManaged" - #: No public IP Address will be created for the Compute Nodes in the Pool. + """Public IPs are provided by the user and will be used to provision the Compute Nodes.""" NO_PUBLIC_IP_ADDRESSES = "NoPublicIPAddresses" + """No public IP Address will be created for the Compute Nodes in the Pool.""" class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the key source.""" - #: Batch creates and manages the encryption keys used to protect the account data. MICROSOFT_BATCH = "Microsoft.Batch" - #: The encryption keys used to protect the account data are stored in an external key vault. If - #: this is set then the Batch Account identity must be set to ``SystemAssigned`` and a valid Key - #: Identifier must also be supplied under the keyVaultProperties. + """Batch creates and manages the encryption keys used to protect the account data.""" MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" + """The encryption keys used to protect the account data are stored in an external key vault. If + #: this is set then the Batch Account identity must be set to ``SystemAssigned`` and a valid Key + #: Identifier must also be supplied under the keyVaultProperties.""" class LoginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -265,13 +274,13 @@ class LoginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): interactive mode and for CloudServiceConfiguration pools is batch mode. """ - #: The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running - #: parallel processes. BATCH = "Batch" - #: The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having permissions - #: associated with the interactive login mode. If this is the case for an application used in your - #: task, then this option is recommended. + """The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running + #: parallel processes.""" INTERACTIVE = "Interactive" + """The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having permissions + #: associated with the interactive login mode. If this is the case for an application used in your + #: task, then this option is recommended.""" class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -279,157 +288,157 @@ class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): returned if NameAvailable is false. """ - #: The requested name is invalid. INVALID = "Invalid" - #: The requested name is already in use. + """The requested name is invalid.""" ALREADY_EXISTS = "AlreadyExists" + """The requested name is already in use.""" class NetworkSecurityGroupRuleAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The action that should be taken for a specified IP address, subnet range or tag.""" - #: Allow access. ALLOW = "Allow" - #: Deny access. + """Allow access.""" DENY = "Deny" + """Deny access.""" class NodeCommunicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines how a pool communicates with the Batch service.""" - #: The node communication mode is automatically set by the Batch service. DEFAULT = "Default" - #: Nodes using the Classic communication mode require inbound TCP communication on ports 29876 and - #: 29877 from the "BatchNodeManagement.{region}" service tag and outbound TCP communication on - #: port 443 to the "Storage.region" and "BatchNodeManagement.{region}" service tags. + """The node communication mode is automatically set by the Batch service.""" CLASSIC = "Classic" - #: Nodes using the Simplified communication mode require outbound TCP communication on port 443 to - #: the "BatchNodeManagement.{region}" service tag. No open inbound ports are required. + """Nodes using the Classic communication mode require inbound TCP communication on ports 29876 and + #: 29877 from the "BatchNodeManagement.{region}" service tag and outbound TCP communication on + #: port 443 to the "Storage.region" and "BatchNodeManagement.{region}" service tags.""" SIMPLIFIED = "Simplified" + """Nodes using the Simplified communication mode require outbound TCP communication on port 443 to + #: the "BatchNodeManagement.{region}" service tag. No open inbound ports are required.""" class NodePlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default value is regional.""" - #: All nodes in the pool will be allocated in the same region. REGIONAL = "Regional" - #: Nodes in the pool will be spread across different zones with best effort balancing. + """All nodes in the pool will be allocated in the same region.""" ZONAL = "Zonal" + """Nodes in the pool will be spread across different zones with best effort balancing.""" class PackageState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of the application package.""" - #: The application package has been created but has not yet been activated. PENDING = "Pending" - #: The application package is ready for use. + """The application package has been created but has not yet been activated.""" ACTIVE = "Active" + """The application package is ready for use.""" class PoolAllocationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The allocation mode for creating pools in the Batch account.""" - #: Pools will be allocated in subscriptions owned by the Batch service. BATCH_SERVICE = "BatchService" - #: Pools will be allocated in a subscription owned by the user. + """Pools will be allocated in subscriptions owned by the Batch service.""" USER_SUBSCRIPTION = "UserSubscription" + """Pools will be allocated in a subscription owned by the user.""" class PoolIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the Batch Pool.""" - #: Batch pool has user assigned identities with it. USER_ASSIGNED = "UserAssigned" - #: Batch pool has no identity associated with it. Setting ``None`` in update pool will remove - #: existing identities. + """Batch pool has user assigned identities with it.""" NONE = "None" + """Batch pool has no identity associated with it. Setting ``None`` in update pool will remove + #: existing identities.""" class PoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of the pool.""" - #: The pool is available to run tasks subject to the availability of compute nodes. SUCCEEDED = "Succeeded" - #: The user has requested that the pool be deleted, but the delete operation has not yet - #: completed. + """The pool is available to run tasks subject to the availability of compute nodes.""" DELETING = "Deleting" + """The user has requested that the pool be deleted, but the delete operation has not yet + #: completed.""" class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the private endpoint connection.""" - #: 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. + """The connection is creating.""" UPDATING = "Updating" - #: The connection is deleting. + """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.""" DELETING = "Deleting" - #: The connection status is final and is ready for use if Status is Approved. + """The connection is deleting.""" SUCCEEDED = "Succeeded" - #: The user requested that the connection be updated and it failed. You may retry the update - #: operation. + """The connection status is final and is ready for use if Status is Approved.""" FAILED = "Failed" - #: The user has cancelled the connection creation. + """The user requested that the connection be updated and it failed. You may retry the update + #: operation.""" CANCELLED = "Cancelled" + """The user has cancelled the connection creation.""" class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the Batch private endpoint connection.""" - #: The private endpoint connection is approved and can be used to access Batch account APPROVED = "Approved" - #: The private endpoint connection is pending and cannot be used to access Batch account + """The private endpoint connection is approved and can be used to access Batch account""" PENDING = "Pending" - #: The private endpoint connection is rejected and cannot be used to access Batch account + """The private endpoint connection is pending and cannot be used to access Batch account""" REJECTED = "Rejected" - #: The private endpoint connection is disconnected and cannot be used to access Batch account + """The private endpoint connection is rejected and cannot be used to access Batch account""" DISCONNECTED = "Disconnected" + """The private endpoint connection is disconnected and cannot be used to access Batch account""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioned state of the resource.""" - #: The account is in an invalid state. INVALID = "Invalid" - #: The account is being created. + """The account is in an invalid state.""" CREATING = "Creating" - #: The account is being deleted. + """The account is being created.""" DELETING = "Deleting" - #: The account has been created and is ready for use. + """The account is being deleted.""" SUCCEEDED = "Succeeded" - #: The last operation for the account is failed. + """The account has been created and is ready for use.""" FAILED = "Failed" - #: The last operation for the account is cancelled. + """The last operation for the account is failed.""" CANCELLED = "Cancelled" + """The last operation for the account is cancelled.""" class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The network access type for operating on the resources in the Batch account.""" - #: Enables connectivity to Azure Batch through public DNS. ENABLED = "Enabled" - #: Disables public connectivity and enables private connectivity to Azure Batch Service through - #: private endpoint resource. + """Enables connectivity to Azure Batch through public DNS.""" DISABLED = "Disabled" + """Disables public connectivity and enables private connectivity to Azure Batch Service through + #: private endpoint resource.""" class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the Batch account.""" - #: Batch account has a system assigned identity with it. SYSTEM_ASSIGNED = "SystemAssigned" - #: Batch account has user assigned identities with it. + """Batch account has a system assigned identity with it.""" USER_ASSIGNED = "UserAssigned" - #: Batch account has no identity associated with it. Setting ``None`` in update account will - #: remove existing identities. + """Batch account has user assigned identities with it.""" NONE = "None" + """Batch account has no identity associated with it. Setting ``None`` in update account will + #: remove existing identities.""" class StorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The storage account type for use in creating data disks.""" - #: The data disk should use standard locally redundant storage. STANDARD_LRS = "Standard_LRS" - #: The data disk should use premium locally redundant storage. + """The data disk should use standard locally redundant storage.""" PREMIUM_LRS = "Premium_LRS" + """The data disk should use premium locally redundant storage.""" 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 6386e6f77eef..ea6a2d0a4e61 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 @@ -45,7 +45,7 @@ class ActivateApplicationPackageParameters(_serialization.Model): "format": {"key": "format", "type": "str"}, } - def __init__(self, *, format: str, **kwargs): + def __init__(self, *, format: str, **kwargs: Any) -> None: """ :keyword format: The format of the application package binary file. Required. :paramtype format: str @@ -83,7 +83,7 @@ class ProxyResource(_serialization.Model): "etag": {"key": "etag", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -138,8 +138,8 @@ def __init__( display_name: Optional[str] = None, allow_updates: Optional[bool] = None, default_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The display name for the application. :paramtype display_name: str @@ -207,7 +207,7 @@ class ApplicationPackage(ProxyResource): "last_activation_time": {"key": "properties.lastActivationTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.state = None @@ -241,7 +241,9 @@ class ApplicationPackageReference(_serialization.Model): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, id: str, version: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, version: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: The ID of the application package to install. This must be inside the same batch account as the pool. This can either be a reference to a specific version or the default @@ -287,8 +289,8 @@ def __init__( evaluation_time: datetime.datetime, results: Optional[str] = None, error: Optional["_models.AutoScaleRunError"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword evaluation_time: The time at which the autoscale formula was last evaluated. Required. :paramtype evaluation_time: ~datetime.datetime @@ -331,8 +333,8 @@ class AutoScaleRunError(_serialization.Model): } def __init__( - self, *, code: str, message: str, details: Optional[List["_models.AutoScaleRunError"]] = None, **kwargs - ): + self, *, code: str, message: str, details: Optional[List["_models.AutoScaleRunError"]] = None, **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. Required. @@ -369,7 +371,9 @@ class AutoScaleSettings(_serialization.Model): "evaluation_interval": {"key": "evaluationInterval", "type": "duration"}, } - def __init__(self, *, formula: str, evaluation_interval: Optional[datetime.timedelta] = None, **kwargs): + def __init__( + self, *, formula: str, evaluation_interval: Optional[datetime.timedelta] = None, **kwargs: Any + ) -> None: """ :keyword formula: A formula for the desired number of compute nodes in the pool. Required. :paramtype formula: str @@ -413,8 +417,8 @@ def __init__( storage_account_id: str, authentication_mode: Union[str, "_models.AutoStorageAuthenticationMode"] = "StorageKeys", node_identity_reference: Optional["_models.ComputeNodeIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword storage_account_id: The resource ID of the storage account to be used for auto-storage account. Required. @@ -471,8 +475,8 @@ def __init__( last_key_sync: datetime.datetime, authentication_mode: Union[str, "_models.AutoStorageAuthenticationMode"] = "StorageKeys", node_identity_reference: Optional["_models.ComputeNodeIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword storage_account_id: The resource ID of the storage account to be used for auto-storage account. Required. @@ -520,8 +524,8 @@ def __init__( *, scope: Optional[Union[str, "_models.AutoUserScope"]] = None, elevation_level: Optional[Union[str, "_models.ElevationLevel"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword scope: The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task @@ -589,8 +593,8 @@ def __init__( sas_key: Optional[str] = None, blobfuse_options: Optional[str] = None, identity_reference: Optional["_models.ComputeNodeIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword account_name: The Azure Storage Account name. Required. :paramtype account_name: str @@ -662,8 +666,8 @@ def __init__( account_key: str, relative_mount_path: str, mount_options: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword account_name: The Azure Storage account name. Required. :paramtype account_name: str @@ -719,7 +723,7 @@ class Resource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -866,8 +870,8 @@ def __init__( identity: Optional["_models.BatchAccountIdentity"] = None, public_network_access: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", network_profile: Optional["_models.NetworkProfile"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: The identity of the Batch account. :paramtype identity: ~azure.mgmt.batch.models.BatchAccountIdentity @@ -967,8 +971,8 @@ def __init__( network_profile: Optional["_models.NetworkProfile"] = None, encryption: Optional["_models.EncryptionProperties"] = None, allowed_authentication_modes: Optional[List[Union[str, "_models.AuthenticationMode"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: The region in which to create the account. Required. :paramtype location: str @@ -1017,7 +1021,9 @@ def __init__( class BatchAccountIdentity(_serialization.Model): - """The identity of the Batch account, if configured. This is used when the user specifies 'Microsoft.KeyVault' as their Batch account encryption configuration or when ``ManagedIdentity`` is selected as the auto-storage authentication mode. + """The identity of the Batch account, if configured. This is used when the user specifies + 'Microsoft.KeyVault' as their Batch account encryption configuration or when + ``ManagedIdentity`` is selected as the auto-storage authentication mode. Variables are only populated by the server, and will be ignored when sending a request. @@ -1054,8 +1060,8 @@ def __init__( *, type: Union[str, "_models.ResourceIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the Batch account. Required. Known values are: "SystemAssigned", "UserAssigned", and "None". @@ -1096,7 +1102,7 @@ class BatchAccountKeys(_serialization.Model): "secondary": {"key": "secondary", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.account_name = None @@ -1119,8 +1125,8 @@ class BatchAccountListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.BatchAccount"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.BatchAccount"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection of Batch accounts returned by the listing operation. :paramtype value: list[~azure.mgmt.batch.models.BatchAccount] @@ -1150,7 +1156,7 @@ class BatchAccountRegenerateKeyParameters(_serialization.Model): "key_name": {"key": "keyName", "type": "str"}, } - def __init__(self, *, key_name: Union[str, "_models.AccountKeyType"], **kwargs): + def __init__(self, *, key_name: Union[str, "_models.AccountKeyType"], **kwargs: Any) -> None: """ :keyword key_name: The type of account key to regenerate. Required. Known values are: "Primary" and "Secondary". @@ -1205,8 +1211,8 @@ def __init__( allowed_authentication_modes: Optional[List[Union[str, "_models.AuthenticationMode"]]] = None, public_network_access: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", network_profile: Optional["_models.NetworkProfile"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: The user-specified tags associated with the account. :paramtype tags: dict[str, str] @@ -1258,14 +1264,16 @@ class BatchLocationQuota(_serialization.Model): "account_quota": {"key": "accountQuota", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.account_quota = None class BatchPoolIdentity(_serialization.Model): - """The identity of the Batch pool, if configured. If the pool identity is updated during update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the updated identities. + """The identity of the Batch pool, if configured. If the pool identity is updated during update an + existing pool, only the new vms which are created after the pool shrinks to 0 will have the + updated identities. All required parameters must be populated in order to send to Azure. @@ -1290,8 +1298,8 @@ def __init__( *, type: Union[str, "_models.PoolIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentities"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of identity used for the Batch Pool. Required. Known values are: "UserAssigned" and "None". @@ -1382,8 +1390,8 @@ def __init__( thumbprint_algorithm: Optional[str] = None, thumbprint: Optional[str] = None, format: Optional[Union[str, "_models.CertificateFormat"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. @@ -1431,8 +1439,8 @@ def __init__( thumbprint_algorithm: Optional[str] = None, thumbprint: Optional[str] = None, format: Optional[Union[str, "_models.CertificateFormat"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. @@ -1503,8 +1511,8 @@ def __init__( format: Optional[Union[str, "_models.CertificateFormat"]] = None, data: Optional[str] = None, password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. @@ -1566,8 +1574,8 @@ def __init__( thumbprint: Optional[str] = None, format: Optional[Union[str, "_models.CertificateFormat"]] = None, password: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. @@ -1649,8 +1657,8 @@ def __init__( thumbprint_algorithm: Optional[str] = None, thumbprint: Optional[str] = None, format: Optional[Union[str, "_models.CertificateFormat"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword thumbprint_algorithm: This must match the first portion of the certificate name. Currently required to be 'SHA1'. @@ -1671,7 +1679,9 @@ def __init__( class CertificateReference(_serialization.Model): - """Warning: This object is deprecated and will be removed after February, 2024. Please use the `Azure KeyVault Extension `_ instead. + """Warning: This object is deprecated and will be removed after February, 2024. Please use the + `Azure KeyVault Extension + `_ instead. All required parameters must be populated in order to send to Azure. @@ -1716,8 +1726,8 @@ def __init__( store_location: Optional[Union[str, "_models.CertificateStoreLocation"]] = None, store_name: Optional[str] = None, visibility: Optional[List[Union[str, "_models.CertificateVisibility"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The fully qualified ID of the certificate to install on the pool. This must be inside the same batch account as the pool. Required. @@ -1773,7 +1783,7 @@ class CheckNameAvailabilityParameters(_serialization.Model): type = "Microsoft.Batch/batchAccounts" - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: The name to check for availability. Required. :paramtype name: str @@ -1810,7 +1820,7 @@ class CheckNameAvailabilityResult(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name_available = None @@ -1859,8 +1869,8 @@ def __init__( relative_mount_path: str, password: str, mount_options: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: The user to use for authentication against the CIFS file system. Required. :paramtype user_name: str @@ -1913,8 +1923,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -1961,7 +1971,7 @@ class CloudServiceConfiguration(_serialization.Model): "os_version": {"key": "osVersion", "type": "str"}, } - def __init__(self, *, os_family: str, os_version: Optional[str] = None, **kwargs): + def __init__(self, *, os_family: str, os_version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword os_family: Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows @@ -1980,7 +1990,8 @@ def __init__(self, *, os_family: str, os_version: Optional[str] = None, **kwargs class ComputeNodeIdentityReference(_serialization.Model): - """The reference to a user assigned identity associated with the Batch pool which a compute node will use. + """The reference to a user assigned identity associated with the Batch pool which a compute node + will use. :ivar resource_id: The ARM resource id of the user assigned identity. :vartype resource_id: str @@ -1990,7 +2001,7 @@ class ComputeNodeIdentityReference(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_id: The ARM resource id of the user assigned identity. :paramtype resource_id: str @@ -2002,12 +2013,11 @@ def __init__(self, *, resource_id: Optional[str] = None, **kwargs): class ContainerConfiguration(_serialization.Model): """The configuration for container-enabled pools. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :ivar type: The container technology to be used. Required. Default value is "DockerCompatible". - :vartype type: str + :ivar type: The container technology to be used. Required. Known values are: "DockerCompatible" + and "CriCompatible". + :vartype type: str or ~azure.mgmt.batch.models.ContainerType :ivar container_image_names: This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. @@ -2018,7 +2028,7 @@ class ContainerConfiguration(_serialization.Model): """ _validation = { - "type": {"required": True, "constant": True}, + "type": {"required": True}, } _attribute_map = { @@ -2027,16 +2037,18 @@ class ContainerConfiguration(_serialization.Model): "container_registries": {"key": "containerRegistries", "type": "[ContainerRegistry]"}, } - type = "DockerCompatible" - def __init__( self, *, + type: Union[str, "_models.ContainerType"], container_image_names: Optional[List[str]] = None, container_registries: Optional[List["_models.ContainerRegistry"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword type: The container technology to be used. Required. Known values are: + "DockerCompatible" and "CriCompatible". + :paramtype type: str or ~azure.mgmt.batch.models.ContainerType :keyword container_image_names: This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. @@ -2046,6 +2058,7 @@ def __init__( :paramtype container_registries: list[~azure.mgmt.batch.models.ContainerRegistry] """ super().__init__(**kwargs) + self.type = type self.container_image_names = container_image_names self.container_registries = container_registries @@ -2078,8 +2091,8 @@ def __init__( password: Optional[str] = None, registry_server: Optional[str] = None, identity_reference: Optional["_models.ComputeNodeIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: The user name to log into the registry server. :paramtype user_name: str @@ -2099,7 +2112,8 @@ def __init__( class DataDisk(_serialization.Model): - """Settings which will be used by the data disks associated to Compute Nodes in the Pool. When using attached data disks, you need to mount and format the disks from within a VM to use them. + """Settings which will be used by the data disks associated to Compute Nodes in the Pool. When + using attached data disks, you need to mount and format the disks from within a VM to use them. All required parameters must be populated in order to send to Azure. @@ -2145,8 +2159,8 @@ def __init__( disk_size_gb: int, caching: Optional[Union[str, "_models.CachingType"]] = None, storage_account_type: Optional[Union[str, "_models.StorageAccountType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword lun: The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. Required. @@ -2214,8 +2228,8 @@ def __init__( message: str, target: Optional[str] = None, details: Optional[List["_models.DeleteCertificateError"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. Required. @@ -2258,8 +2272,8 @@ def __init__( *, cloud_service_configuration: Optional["_models.CloudServiceConfiguration"] = None, virtual_machine_configuration: Optional["_models.VirtualMachineConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cloud_service_configuration: This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be @@ -2290,8 +2304,12 @@ class DetectorListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DetectorResponse"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.DetectorResponse"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The collection of Batch account detectors returned by the listing operation. :paramtype value: list[~azure.mgmt.batch.models.DetectorResponse] @@ -2335,7 +2353,7 @@ class DetectorResponse(ProxyResource): "value": {"key": "properties.value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: A base64 encoded string that represents the content of a detector. :paramtype value: str @@ -2345,7 +2363,8 @@ def __init__(self, *, value: Optional[str] = None, **kwargs): class DiffDiskSettings(_serialization.Model): - """Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + """Specifies the ephemeral Disk Settings for the operating system disk used by the virtual + machine. :ivar placement: This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For @@ -2362,7 +2381,7 @@ class DiffDiskSettings(_serialization.Model): "placement": {"key": "placement", "type": "str"}, } - def __init__(self, *, placement: Optional[Literal["CacheDisk"]] = None, **kwargs): + def __init__(self, *, placement: Optional[Literal["CacheDisk"]] = None, **kwargs: Any) -> None: """ :keyword placement: This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. @@ -2379,7 +2398,9 @@ def __init__(self, *, placement: Optional[Literal["CacheDisk"]] = None, **kwargs class DiskEncryptionConfiguration(_serialization.Model): - """The disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image. + """The disk encryption configuration applied on compute nodes in the pool. Disk encryption + configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image + Gallery Image. :ivar targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. @@ -2390,7 +2411,9 @@ class DiskEncryptionConfiguration(_serialization.Model): "targets": {"key": "targets", "type": "[str]"}, } - def __init__(self, *, targets: Optional[List[Union[str, "_models.DiskEncryptionTarget"]]] = None, **kwargs): + def __init__( + self, *, targets: Optional[List[Union[str, "_models.DiskEncryptionTarget"]]] = None, **kwargs: Any + ) -> None: """ :keyword targets: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. @@ -2401,7 +2424,9 @@ def __init__(self, *, targets: Optional[List[Union[str, "_models.DiskEncryptionT class EncryptionProperties(_serialization.Model): - """Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + """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. :ivar key_source: Type of the key source. Known values are: "Microsoft.Batch" and "Microsoft.KeyVault". @@ -2420,8 +2445,8 @@ def __init__( *, key_source: Optional[Union[str, "_models.KeySource"]] = None, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword key_source: Type of the key source. Known values are: "Microsoft.Batch" and "Microsoft.KeyVault". @@ -2460,8 +2485,8 @@ def __init__( *, default_action: Union[str, "_models.EndpointAccessDefaultAction"], ip_rules: Optional[List["_models.IPRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_action: Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. Required. Known values are: "Allow" and "Deny". @@ -2501,7 +2526,7 @@ class EndpointDependency(_serialization.Model): "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.domain_name = None @@ -2526,7 +2551,7 @@ class EndpointDetail(_serialization.Model): "port": {"key": "port", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.port = None @@ -2552,7 +2577,7 @@ class EnvironmentSetting(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: str, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the environment variable. Required. :paramtype name: str @@ -2598,8 +2623,8 @@ def __init__( target_dedicated_nodes: Optional[int] = None, target_low_priority_nodes: Optional[int] = None, node_deallocation_option: Optional[Union[str, "_models.ComputeNodeDeallocationOption"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resize_timeout: The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value @@ -2625,7 +2650,9 @@ def __init__( class ImageReference(_serialization.Model): - """A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. + """A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a + custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the + 'List supported node agent SKUs' operation. :ivar publisher: For example, Canonical or MicrosoftWindowsServer. :vartype publisher: str @@ -2659,8 +2686,8 @@ def __init__( sku: Optional[str] = None, version: Optional[str] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: For example, Canonical or MicrosoftWindowsServer. :paramtype publisher: str @@ -2686,7 +2713,8 @@ def __init__( class InboundNatPool(_serialization.Model): - """A inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool externally. + """A inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool + externally. All required parameters must be populated in order to send to Azure. @@ -2745,8 +2773,8 @@ def __init__( frontend_port_range_start: int, frontend_port_range_end: int, network_security_group_rules: Optional[List["_models.NetworkSecurityGroupRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a @@ -2811,7 +2839,7 @@ class IPRule(_serialization.Model): action = "Allow" - def __init__(self, *, value: str, **kwargs): + def __init__(self, *, value: str, **kwargs: Any) -> None: """ :keyword value: IPv4 address, or IPv4 address range in CIDR format. Required. :paramtype value: str @@ -2823,9 +2851,10 @@ def __init__(self, *, value: str, **kwargs): class KeyVaultProperties(_serialization.Model): """KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. - :ivar key_identifier: Full path to the versioned secret. Example - https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable - the following prerequisites must be met: + :ivar key_identifier: Full path to the secret with or without version. Example + https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. or + https://mykeyvault.vault.azure.net/keys/testkey. To be usable the following prerequisites must + be met: The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions @@ -2837,11 +2866,12 @@ class KeyVaultProperties(_serialization.Model): "key_identifier": {"key": "keyIdentifier", "type": "str"}, } - def __init__(self, *, key_identifier: Optional[str] = None, **kwargs): + def __init__(self, *, key_identifier: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword key_identifier: Full path to the versioned secret. Example - https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable - the following prerequisites must be met: + :keyword key_identifier: Full path to the secret with or without version. Example + https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. or + https://mykeyvault.vault.azure.net/keys/testkey. To be usable the following prerequisites must + be met: The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions @@ -2873,7 +2903,7 @@ class KeyVaultReference(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, id: str, url: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, url: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the Azure key vault associated with the Batch account. Required. @@ -2911,8 +2941,13 @@ class LinuxUserConfiguration(_serialization.Model): } def __init__( - self, *, uid: Optional[int] = None, gid: Optional[int] = None, ssh_private_key: Optional[str] = None, **kwargs - ): + self, + *, + uid: Optional[int] = None, + gid: Optional[int] = None, + ssh_private_key: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword uid: The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. @@ -2949,8 +2984,12 @@ class ListApplicationPackagesResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ApplicationPackage"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ApplicationPackage"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of application packages. :paramtype value: list[~azure.mgmt.batch.models.ApplicationPackage] @@ -2977,8 +3016,8 @@ class ListApplicationsResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Application"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Application"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of applications. :paramtype value: list[~azure.mgmt.batch.models.Application] @@ -3005,8 +3044,8 @@ class ListCertificatesResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.Certificate"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection of returned certificates. :paramtype value: list[~azure.mgmt.batch.models.Certificate] @@ -3032,7 +3071,9 @@ class ListPoolsResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Pool"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Pool"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The collection of returned pools. :paramtype value: list[~azure.mgmt.batch.models.Pool] @@ -3063,8 +3104,8 @@ def __init__( *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: The collection of returned private endpoint connection. :paramtype value: list[~azure.mgmt.batch.models.PrivateEndpointConnection] @@ -3091,8 +3132,12 @@ class ListPrivateLinkResourcesResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The collection of returned private link resources. :paramtype value: list[~azure.mgmt.batch.models.PrivateLinkResource] @@ -3105,7 +3150,8 @@ def __init__( class MetadataItem(_serialization.Model): - """The Batch service does not assign any meaning to this metadata; it is solely for the use of user code. + """The Batch service does not assign any meaning to this metadata; it is solely for the use of + user code. All required parameters must be populated in order to send to Azure. @@ -3125,7 +3171,7 @@ class MetadataItem(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str, value: str, **kwargs): + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: """ :keyword name: The name of the metadata item. Required. :paramtype name: str @@ -3170,8 +3216,8 @@ def __init__( nfs_mount_configuration: Optional["_models.NFSMountConfiguration"] = None, cifs_mount_configuration: Optional["_models.CIFSMountConfiguration"] = None, azure_file_share_configuration: Optional["_models.AzureFileShareConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_blob_file_system_configuration: This property is mutually exclusive with all other properties. @@ -3225,6 +3271,11 @@ class NetworkConfiguration(_serialization.Model): :ivar public_ip_address_configuration: This property is only supported on Pools with the virtualMachineConfiguration property. :vartype public_ip_address_configuration: ~azure.mgmt.batch.models.PublicIPAddressConfiguration + :ivar enable_accelerated_networking: Accelerated networking enables single root I/O + virtualization (SR-IOV) to a VM, which may lead to improved networking performance. For more + details, see: + https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview. + :vartype enable_accelerated_networking: bool """ _attribute_map = { @@ -3235,6 +3286,7 @@ class NetworkConfiguration(_serialization.Model): "key": "publicIPAddressConfiguration", "type": "PublicIPAddressConfiguration", }, + "enable_accelerated_networking": {"key": "enableAcceleratedNetworking", "type": "bool"}, } def __init__( @@ -3244,8 +3296,9 @@ def __init__( dynamic_vnet_assignment_scope: Optional[Union[str, "_models.DynamicVNetAssignmentScope"]] = None, endpoint_configuration: Optional["_models.PoolEndpointConfiguration"] = None, public_ip_address_configuration: Optional["_models.PublicIPAddressConfiguration"] = None, - **kwargs - ): + enable_accelerated_networking: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword subnet_id: The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate @@ -3276,12 +3329,18 @@ def __init__( virtualMachineConfiguration property. :paramtype public_ip_address_configuration: ~azure.mgmt.batch.models.PublicIPAddressConfiguration + :keyword enable_accelerated_networking: Accelerated networking enables single root I/O + virtualization (SR-IOV) to a VM, which may lead to improved networking performance. For more + details, see: + https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview. + :paramtype enable_accelerated_networking: bool """ super().__init__(**kwargs) self.subnet_id = subnet_id self.dynamic_vnet_assignment_scope = dynamic_vnet_assignment_scope self.endpoint_configuration = endpoint_configuration self.public_ip_address_configuration = public_ip_address_configuration + self.enable_accelerated_networking = enable_accelerated_networking class NetworkProfile(_serialization.Model): @@ -3305,8 +3364,8 @@ def __init__( *, account_access: Optional["_models.EndpointAccessProfile"] = None, node_management_access: Optional["_models.EndpointAccessProfile"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword account_access: Network access profile for batchAccount endpoint (Batch account data plane API). @@ -3365,8 +3424,8 @@ def __init__( access: Union[str, "_models.NetworkSecurityGroupRuleAccess"], source_address_prefix: str, source_port_ranges: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword priority: Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified @@ -3419,7 +3478,9 @@ class NFSMountConfiguration(_serialization.Model): "mount_options": {"key": "mountOptions", "type": "str"}, } - def __init__(self, *, source: str, relative_mount_path: str, mount_options: Optional[str] = None, **kwargs): + def __init__( + self, *, source: str, relative_mount_path: str, mount_options: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword source: The URI of the file system to mount. Required. :paramtype source: str @@ -3447,7 +3508,9 @@ class NodePlacementConfiguration(_serialization.Model): "policy": {"key": "policy", "type": "str"}, } - def __init__(self, *, policy: Optional[Union[str, "_models.NodePlacementPolicyType"]] = None, **kwargs): + def __init__( + self, *, policy: Optional[Union[str, "_models.NodePlacementPolicyType"]] = None, **kwargs: Any + ) -> None: """ :keyword policy: Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Known values are: "Regional" and "Zonal". @@ -3488,8 +3551,8 @@ def __init__( display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: This is of the format {provider}/{resource}/{operation}. :paramtype name: str @@ -3537,8 +3600,8 @@ def __init__( operation: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -3557,7 +3620,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + """Result of the request to list REST API operations. It contains a list of operations and a URL + nextLink to get the next set of results. :ivar value: The list of operations supported by the resource provider. :vartype value: list[~azure.mgmt.batch.models.Operation] @@ -3570,7 +3634,9 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.batch.models.Operation] @@ -3594,7 +3660,9 @@ class OSDisk(_serialization.Model): "ephemeral_os_disk_settings": {"key": "ephemeralOSDiskSettings", "type": "DiffDiskSettings"}, } - def __init__(self, *, ephemeral_os_disk_settings: Optional["_models.DiffDiskSettings"] = None, **kwargs): + def __init__( + self, *, ephemeral_os_disk_settings: Optional["_models.DiffDiskSettings"] = None, **kwargs: Any + ) -> None: """ :keyword ephemeral_os_disk_settings: Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. @@ -3605,7 +3673,8 @@ def __init__(self, *, ephemeral_os_disk_settings: Optional["_models.DiffDiskSett class OutboundEnvironmentEndpoint(_serialization.Model): - """A collection of related endpoints from the same service for which the Batch service requires outbound access. + """A collection of related endpoints from the same service for which the Batch service requires + outbound access. Variables are only populated by the server, and will be ignored when sending a request. @@ -3626,7 +3695,7 @@ class OutboundEnvironmentEndpoint(_serialization.Model): "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.category = None @@ -3654,7 +3723,7 @@ class OutboundEnvironmentEndpointCollection(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The continuation token. :paramtype next_link: str @@ -3855,8 +3924,8 @@ def __init__( # pylint: disable=too-many-locals application_licenses: Optional[List[str]] = None, mount_configuration: Optional[List["_models.MountConfiguration"]] = None, target_node_communication_mode: Optional[Union[str, "_models.NodeCommunicationMode"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword identity: The type of identity used for the Batch Pool. :paramtype identity: ~azure.mgmt.batch.models.BatchPoolIdentity @@ -3982,7 +4051,7 @@ class PoolEndpointConfiguration(_serialization.Model): "inbound_nat_pools": {"key": "inboundNatPools", "type": "[InboundNatPool]"}, } - def __init__(self, *, inbound_nat_pools: List["_models.InboundNatPool"], **kwargs): + def __init__(self, *, inbound_nat_pools: List["_models.InboundNatPool"], **kwargs: Any) -> None: """ :keyword inbound_nat_pools: The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. @@ -4011,7 +4080,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -4072,8 +4141,8 @@ def __init__( self, *, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link_service_connection_state: The private link service connection state of the private endpoint connection. @@ -4129,7 +4198,7 @@ class PrivateLinkResource(ProxyResource): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.group_id = None @@ -4169,8 +4238,8 @@ def __init__( *, status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the Batch private endpoint connection. Required. Known values are: "Approved", "Pending", "Rejected", and "Disconnected". @@ -4208,8 +4277,8 @@ def __init__( *, provision: Optional[Union[str, "_models.IPAddressProvisioningType"]] = None, ip_address_ids: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provision: The default value is BatchManaged. Known values are: "BatchManaged", "UserManaged", and "NoPublicIPAddresses". @@ -4252,7 +4321,9 @@ class ResizeError(_serialization.Model): "details": {"key": "details", "type": "[ResizeError]"}, } - def __init__(self, *, code: str, message: str, details: Optional[List["_models.ResizeError"]] = None, **kwargs): + def __init__( + self, *, code: str, message: str, details: Optional[List["_models.ResizeError"]] = None, **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. Required. @@ -4270,7 +4341,8 @@ def __init__(self, *, code: str, message: str, details: Optional[List["_models.R class ResizeOperationStatus(_serialization.Model): - """Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed operation (if the AllocationState is Steady). + """Describes either the current operation (if the pool AllocationState is Resizing) or the + previously completed operation (if the AllocationState is Steady). :ivar target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. :vartype target_dedicated_nodes: int @@ -4310,8 +4382,8 @@ def __init__( node_deallocation_option: Optional[Union[str, "_models.ComputeNodeDeallocationOption"]] = None, start_time: Optional[datetime.datetime] = None, errors: Optional[List["_models.ResizeError"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword target_dedicated_nodes: The desired number of dedicated compute nodes in the pool. :paramtype target_dedicated_nodes: int @@ -4403,8 +4475,8 @@ def __init__( file_path: Optional[str] = None, file_mode: Optional[str] = None, identity_reference: Optional["_models.ComputeNodeIdentityReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auto_storage_container_name: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. @@ -4455,7 +4527,10 @@ def __init__( class ScaleSettings(_serialization.Model): - """Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. + """Defines the desired size of the pool. This can either be 'fixedScale' where the requested + targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically + reevaluated. If this property is not specified, the pool will have a fixed scale with 0 + targetDedicatedNodes. :ivar fixed_scale: This property and autoScale are mutually exclusive and one of the properties must be specified. @@ -4475,8 +4550,8 @@ def __init__( *, fixed_scale: Optional["_models.FixedScaleSettings"] = None, auto_scale: Optional["_models.AutoScaleSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword fixed_scale: This property and autoScale are mutually exclusive and one of the properties must be specified. @@ -4511,7 +4586,7 @@ class SkuCapability(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -4519,7 +4594,11 @@ def __init__(self, **kwargs): class StartTask(_serialization.Model): - """In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task. + """In some cases the start task may be re-run even though the node was not rebooted. Due to this, + start tasks should be idempotent and exit gracefully if the setup they're performing has + already been done. Special care should be taken to avoid start tasks which create breakaway + process or install/launch services from the start task working directory, as this will block + Batch from being able to re-run the start task. :ivar command_line: The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take @@ -4577,8 +4656,8 @@ def __init__( max_task_retry_count: Optional[int] = None, wait_for_success: Optional[bool] = None, container_settings: Optional["_models.TaskContainerSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword command_line: The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take @@ -4651,7 +4730,7 @@ class SupportedSku(_serialization.Model): "capabilities": {"key": "capabilities", "type": "[SkuCapability]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -4682,7 +4761,7 @@ class SupportedSkusResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.SupportedSku"], **kwargs): + def __init__(self, *, value: List["_models.SupportedSku"], **kwargs: Any) -> None: """ :keyword value: The list of SKUs available for the Batch service in the location. Required. :paramtype value: list[~azure.mgmt.batch.models.SupportedSku] @@ -4729,8 +4808,8 @@ def __init__( container_run_options: Optional[str] = None, registry: Optional["_models.ContainerRegistry"] = None, working_directory: Optional[Union[str, "_models.ContainerWorkingDirectory"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword container_run_options: These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. @@ -4771,7 +4850,7 @@ class TaskSchedulingPolicy(_serialization.Model): "node_fill_type": {"key": "nodeFillType", "type": "str"}, } - def __init__(self, *, node_fill_type: Union[str, "_models.ComputeNodeFillType"], **kwargs): + def __init__(self, *, node_fill_type: Union[str, "_models.ComputeNodeFillType"], **kwargs: Any) -> None: """ :keyword node_fill_type: How tasks should be distributed across compute nodes. Required. Known values are: "Spread" and "Pack". @@ -4825,8 +4904,8 @@ def __init__( elevation_level: Optional[Union[str, "_models.ElevationLevel"]] = None, linux_user_configuration: Optional["_models.LinuxUserConfiguration"] = None, windows_user_configuration: Optional["_models.WindowsUserConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the user account. Names can contain any Unicode characters up to a maximum length of 20. Required. @@ -4874,7 +4953,7 @@ class UserAssignedIdentities(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None @@ -4898,8 +4977,12 @@ class UserIdentity(_serialization.Model): } def __init__( - self, *, user_name: Optional[str] = None, auto_user: Optional["_models.AutoUserSpecification"] = None, **kwargs - ): + self, + *, + user_name: Optional[str] = None, + auto_user: Optional["_models.AutoUserSpecification"] = None, + **kwargs: Any + ) -> None: """ :keyword user_name: The userName and autoUser properties are mutually exclusive; you must specify one but not both. @@ -4914,7 +4997,8 @@ def __init__( class VirtualMachineConfiguration(_serialization.Model): - """The configuration for compute nodes in a pool based on the Azure Virtual Machines infrastructure. + """The configuration for compute nodes in a pool based on the Azure Virtual Machines + infrastructure. All required parameters must be populated in order to send to Azure. @@ -4990,8 +5074,8 @@ def __init__( node_placement_configuration: Optional["_models.NodePlacementConfiguration"] = None, extensions: Optional[List["_models.VMExtension"]] = None, os_disk: Optional["_models.OSDisk"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword image_reference: A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences @@ -5067,7 +5151,7 @@ class VirtualMachineFamilyCoreQuota(_serialization.Model): "core_quota": {"key": "coreQuota", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -5091,6 +5175,9 @@ class VMExtension(_serialization.Model): version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :vartype enable_automatic_upgrade: bool :ivar settings: JSON formatted public settings for the extension. :vartype settings: JSON :ivar protected_settings: The extension can contain either protectedSettings or @@ -5113,6 +5200,7 @@ class VMExtension(_serialization.Model): "type": {"key": "type", "type": "str"}, "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, + "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, "settings": {"key": "settings", "type": "object"}, "protected_settings": {"key": "protectedSettings", "type": "object"}, "provision_after_extensions": {"key": "provisionAfterExtensions", "type": "[str]"}, @@ -5126,11 +5214,12 @@ def __init__( type: str, type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, settings: Optional[JSON] = None, protected_settings: Optional[JSON] = None, provision_after_extensions: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the virtual machine extension. Required. :paramtype name: str @@ -5144,6 +5233,9 @@ def __init__( version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool :keyword settings: JSON formatted public settings for the extension. :paramtype settings: JSON :keyword protected_settings: The extension can contain either protectedSettings or @@ -5159,6 +5251,7 @@ def __init__( self.type = type self.type_handler_version = type_handler_version self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings self.provision_after_extensions = provision_after_extensions @@ -5175,7 +5268,7 @@ class WindowsConfiguration(_serialization.Model): "enable_automatic_updates": {"key": "enableAutomaticUpdates", "type": "bool"}, } - def __init__(self, *, enable_automatic_updates: Optional[bool] = None, **kwargs): + def __init__(self, *, enable_automatic_updates: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword enable_automatic_updates: If omitted, the default value is true. :paramtype enable_automatic_updates: bool @@ -5197,7 +5290,7 @@ class WindowsUserConfiguration(_serialization.Model): "login_mode": {"key": "loginMode", "type": "str"}, } - def __init__(self, *, login_mode: Optional[Union[str, "_models.LoginMode"]] = None, **kwargs): + def __init__(self, *, login_mode: Optional[Union[str, "_models.LoginMode"]] = None, **kwargs: Any) -> None: """ :keyword login_mode: Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools diff --git a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/__init__.py b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/__init__.py index 484efa0258a1..ec302145381b 100644 --- a/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/__init__.py +++ b/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/__init__.py @@ -17,7 +17,7 @@ from ._pool_operations import PoolOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ 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 facd897d10bb..bb852d003807 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,8 +43,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +63,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +82,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +101,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +118,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +137,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,8 +154,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +174,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +198,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +214,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -333,8 +329,8 @@ def create( :param application_name: The name of the application. This must be unique within the account. Required. :type application_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. Default - value is None. + :param parameters: The parameters for the request. Is either a Application type or a IO type. + Default value is None. :type parameters: ~azure.mgmt.batch.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -355,16 +351,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -386,10 +380,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,7 +400,9 @@ 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}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -437,10 +434,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -453,10 +448,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,7 +464,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace def get( @@ -500,10 +498,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -516,10 +512,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -535,7 +532,9 @@ 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}" + } @overload def update( @@ -620,7 +619,7 @@ def update( :param application_name: The name of the application. This must be unique within the account. Required. :type application_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. + :param parameters: The parameters for the request. Is either a Application type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.Application or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -642,16 +641,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Application") @@ -670,10 +667,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -689,7 +687,9 @@ 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}" + } @distributed_trace def list( @@ -713,10 +713,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListApplicationsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListApplicationsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -740,7 +738,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -756,7 +754,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -764,14 +762,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListApplicationsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -783,4 +782,6 @@ 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" + } 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 f288764a793b..0c0c577671ea 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,8 +48,8 @@ def build_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +71,7 @@ def build_activate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +95,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +118,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,7 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +164,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,7 +186,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,7 +208,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +231,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +250,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -384,8 +380,8 @@ def activate( :type application_name: str :param version_name: The version of the application. Required. :type version_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. - Required. + :param parameters: The parameters for the request. Is either a + ActivateApplicationPackageParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.ActivateApplicationPackageParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -406,16 +402,14 @@ def activate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ActivateApplicationPackageParameters") @@ -435,10 +429,11 @@ def activate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,7 +449,9 @@ 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" + } @overload def create( @@ -557,8 +554,8 @@ def create( :type application_name: str :param version_name: The version of the application. Required. :type version_name: str - :param parameters: The parameters for the request. Is either a model type or a IO type. Default - value is None. + :param parameters: The parameters for the request. Is either a ApplicationPackage type or a IO + type. Default value is None. :type parameters: ~azure.mgmt.batch.models.ApplicationPackage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -579,16 +576,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -611,10 +606,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,7 +626,9 @@ 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}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -664,10 +662,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -681,10 +677,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,7 +693,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace def get( @@ -730,10 +729,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationPackage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationPackage] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -747,10 +744,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -766,7 +764,9 @@ 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}" + } @distributed_trace def list( @@ -798,10 +798,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListApplicationPackagesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListApplicationPackagesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -826,7 +824,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -842,7 +840,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -850,14 +848,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListApplicationPackagesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -869,4 +868,6 @@ 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" + } 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 b5b29644a481..014337e5cfcd 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,8 +45,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +62,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,8 +81,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +98,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,7 +117,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +133,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +148,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +164,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,7 +179,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +188,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +203,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +216,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +233,7 @@ def build_synchronize_auto_storage_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +249,7 @@ def build_synchronize_auto_storage_keys_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,8 +266,8 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -287,7 +283,7 @@ def build_regenerate_key_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -306,7 +302,7 @@ def build_get_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -322,7 +318,7 @@ def build_get_keys_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -339,7 +335,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -355,7 +351,7 @@ def build_list_detectors_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -372,7 +368,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -389,7 +385,7 @@ def build_get_detector_request( "detectorId": _SERIALIZER.url("detector_id", detector_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -406,7 +402,7 @@ def build_list_outbound_network_dependencies_endpoints_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -422,7 +418,7 @@ def build_list_outbound_network_dependencies_endpoints_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -470,16 +466,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BatchAccount]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BatchAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountCreateParameters") @@ -497,10 +491,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,7 +518,9 @@ 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}" + } @overload def begin_create( @@ -627,8 +624,8 @@ def begin_create( service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. Required. :type account_name: str - :param parameters: Additional parameters for account creation. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for account creation. Is either a + BatchAccountCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -649,16 +646,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -678,9 +673,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -692,9 +687,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @overload def update( @@ -767,8 +764,8 @@ def update( :type resource_group_name: str :param account_name: The name of the Batch account. Required. :type account_name: str - :param parameters: Additional parameters for account update. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for account update. Is either a + BatchAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -789,16 +786,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountUpdateParameters") @@ -816,10 +811,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,7 +831,9 @@ 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, **kwargs: Any @@ -851,10 +849,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -866,10 +862,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -886,7 +883,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -912,13 +911,11 @@ def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -936,9 +933,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -950,9 +947,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.BatchAccount: @@ -979,10 +978,8 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -994,10 +991,11 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,7 +1011,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo 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}" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.BatchAccount"]: @@ -1027,10 +1027,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.BatchAccount"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1051,7 +1049,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1067,7 +1065,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1075,14 +1073,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1094,7 +1093,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"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BatchAccount"]: @@ -1111,10 +1110,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1136,7 +1133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1152,7 +1149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1160,14 +1157,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BatchAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1179,7 +1177,9 @@ 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" + } @distributed_trace def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statements @@ -1209,10 +1209,8 @@ def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_synchronize_auto_storage_keys_request( resource_group_name=resource_group_name, @@ -1224,10 +1222,11 @@ def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1239,7 +1238,9 @@ def synchronize_auto_storage_keys( # pylint: disable=inconsistent-return-statem 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" + } @overload def regenerate_key( @@ -1327,8 +1328,8 @@ def regenerate_key( :type resource_group_name: str :param account_name: The name of the Batch account. Required. :type account_name: str - :param parameters: The type of key to regenerate. Is either a model type or a IO type. - Required. + :param parameters: The type of key to regenerate. Is either a + BatchAccountRegenerateKeyParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.BatchAccountRegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1349,16 +1350,14 @@ def regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BatchAccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BatchAccountRegenerateKeyParameters") @@ -1376,10 +1375,11 @@ def regenerate_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1395,7 +1395,9 @@ 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" + } @distributed_trace def get_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.BatchAccountKeys: @@ -1427,10 +1429,8 @@ def get_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchAccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchAccountKeys] = kwargs.pop("cls", None) request = build_get_keys_request( resource_group_name=resource_group_name, @@ -1442,10 +1442,11 @@ def get_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1461,7 +1462,9 @@ def get_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) - 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" + } @distributed_trace def list_detectors( @@ -1482,10 +1485,8 @@ def list_detectors( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DetectorListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DetectorListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1508,7 +1509,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1524,7 +1525,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1532,14 +1533,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DetectorListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1551,7 +1553,9 @@ 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" + } @distributed_trace def get_detector( @@ -1582,10 +1586,8 @@ def get_detector( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DetectorResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DetectorResponse] = kwargs.pop("cls", None) request = build_get_detector_request( resource_group_name=resource_group_name, @@ -1598,10 +1600,11 @@ def get_detector( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1617,7 +1620,9 @@ 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}" + } @distributed_trace def list_outbound_network_dependencies_endpoints( @@ -1644,10 +1649,8 @@ def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1670,7 +1673,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1686,7 +1689,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1694,14 +1697,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1713,4 +1717,6 @@ 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" + } 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 e9a35a907db2..57cd37a6241f 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +52,7 @@ def build_list_by_batch_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +68,7 @@ def build_list_by_batch_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -102,8 +98,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +118,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,8 +147,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +188,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +207,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +224,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +243,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,7 +260,7 @@ def build_cancel_deletion_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +279,7 @@ def build_cancel_deletion_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -353,10 +349,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListCertificatesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCertificatesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -382,7 +376,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -398,7 +392,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -406,14 +400,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListCertificatesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,7 +420,9 @@ 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" + } @overload def create( @@ -545,8 +542,8 @@ def create( and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. Required. :type certificate_name: str - :param parameters: Additional parameters for certificate creation. Is either a model type or a - IO type. Required. + :param parameters: Additional parameters for certificate creation. Is either a + CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO :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 @@ -574,16 +571,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -604,10 +599,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -626,7 +622,9 @@ 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}" + } @overload def update( @@ -735,7 +733,8 @@ def update( and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. Required. :type certificate_name: str - :param parameters: Certificate entity to update. Is either a model type or a IO type. Required. + :param parameters: Certificate entity to update. Is either a + CertificateCreateOrUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CertificateCreateOrUpdateParameters or IO :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. Default value is None. @@ -759,16 +758,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters") @@ -788,10 +785,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -810,7 +808,9 @@ 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, certificate_name: str, **kwargs: Any @@ -826,10 +826,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -842,10 +840,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -862,7 +861,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace def begin_delete( @@ -898,13 +899,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -923,9 +922,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -937,9 +936,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def get( @@ -976,10 +977,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -992,10 +991,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1014,7 +1014,9 @@ 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}" + } @distributed_trace def cancel_deletion( @@ -1058,10 +1060,8 @@ def cancel_deletion( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Certificate] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) request = build_cancel_deletion_request( resource_group_name=resource_group_name, @@ -1074,10 +1074,11 @@ def cancel_deletion( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1096,4 +1097,6 @@ 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" + } 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 e3696c9e4f84..754a3110f967 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_get_quotas_request(location_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +53,7 @@ def build_get_quotas_request(location_name: str, subscription_id: str, **kwargs: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +75,7 @@ def build_list_supported_virtual_machine_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +88,7 @@ def build_list_supported_virtual_machine_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -118,7 +114,7 @@ def build_list_supported_cloud_service_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +127,7 @@ def build_list_supported_cloud_service_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -150,8 +146,8 @@ def build_check_name_availability_request(location_name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +160,7 @@ def build_check_name_availability_request(location_name: str, subscription_id: s "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,10 +214,8 @@ def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLocation _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BatchLocationQuota] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BatchLocationQuota] = kwargs.pop("cls", None) request = build_get_quotas_request( location_name=location_name, @@ -232,10 +226,11 @@ def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLocation params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +246,9 @@ def get_quotas(self, location_name: str, **kwargs: Any) -> _models.BatchLocation 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" + } @distributed_trace def list_supported_virtual_machine_skus( @@ -275,10 +272,8 @@ def list_supported_virtual_machine_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -302,7 +297,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -318,7 +313,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -326,14 +321,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,7 +341,9 @@ 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" + } @distributed_trace def list_supported_cloud_service_skus( @@ -369,10 +367,8 @@ def list_supported_cloud_service_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedSkusResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedSkusResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -396,7 +392,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -412,7 +408,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -420,14 +416,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SupportedSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -439,7 +436,9 @@ 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" + } @overload def check_name_availability( @@ -492,8 +491,8 @@ def check_name_availability( :param location_name: The desired region for the name check. Required. :type location_name: str - :param parameters: Properties needed to check the availability of a name. Is either a model - type or a IO type. Required. + :param parameters: Properties needed to check the availability of a name. Is either a + CheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.CheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -514,16 +513,14 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") @@ -540,10 +537,11 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,4 +557,6 @@ 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" + } 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 7899f67bbf7d..18c07f1962df 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +151,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"} 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 a782ac571131..398edaa5a9f8 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +52,7 @@ def build_list_by_batch_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +68,7 @@ def build_list_by_batch_account_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if maxresults is not None: @@ -102,8 +98,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +118,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,8 +147,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +188,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +207,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +224,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +243,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -264,7 +260,7 @@ def build_disable_auto_scale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +279,7 @@ def build_disable_auto_scale_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -300,7 +296,7 @@ def build_stop_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +315,7 @@ def build_stop_resize_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -395,10 +391,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPoolsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPoolsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -424,7 +418,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -440,7 +434,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -448,14 +442,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListPoolsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -467,7 +462,9 @@ 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" + } @overload def create( @@ -569,8 +566,8 @@ def create( :type account_name: str :param pool_name: The pool name. This must be unique within the account. Required. :type pool_name: str - :param parameters: Additional parameters for pool creation. Is either a model type or a IO - type. Required. + :param parameters: Additional parameters for pool creation. Is either a Pool type or a IO type. + Required. :type parameters: ~azure.mgmt.batch.models.Pool or IO :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 @@ -598,16 +595,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Pool") @@ -628,10 +623,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,7 +646,9 @@ 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}" + } @overload def update( @@ -744,7 +742,7 @@ def update( :param pool_name: The pool name. This must be unique within the account. Required. :type pool_name: str :param parameters: Pool properties that should be updated. Properties that are supplied will be - updated, any property not supplied will be unchanged. Is either a model type or a IO type. + updated, any property not supplied will be unchanged. Is either a Pool type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.Pool or IO :param if_match: The entity state (ETag) version of the pool to update. This value can be @@ -769,16 +767,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Pool") @@ -798,10 +794,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,7 +817,9 @@ 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any @@ -836,10 +835,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -852,10 +849,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -872,7 +870,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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}" + } @distributed_trace def begin_delete( @@ -902,13 +902,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -927,9 +925,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -941,9 +939,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: @@ -972,10 +972,8 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -988,10 +986,11 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1010,7 +1009,9 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa 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}" + } @distributed_trace def disable_auto_scale( @@ -1041,10 +1042,8 @@ def disable_auto_scale( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_disable_auto_scale_request( resource_group_name=resource_group_name, @@ -1057,10 +1056,11 @@ def disable_auto_scale( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1079,7 +1079,9 @@ 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" + } @distributed_trace def stop_resize(self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any) -> _models.Pool: @@ -1115,10 +1117,8 @@ def stop_resize(self, resource_group_name: str, account_name: str, pool_name: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Pool] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Pool] = kwargs.pop("cls", None) request = build_stop_resize_request( resource_group_name=resource_group_name, @@ -1131,10 +1131,11 @@ def stop_resize(self, resource_group_name: str, account_name: str, pool_name: st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1153,4 +1154,6 @@ def stop_resize(self, resource_group_name: str, account_name: str, pool_name: st 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" + } 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 6cdc7d7a117c..1c19754befed 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 @@ -6,7 +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 sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +50,7 @@ def build_list_by_batch_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +66,7 @@ def build_list_by_batch_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +113,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,8 +136,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +161,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +210,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,10 +263,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPrivateEndpointConnectionsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPrivateEndpointConnectionsResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -294,7 +288,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -310,7 +304,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,14 +312,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListPrivateEndpointConnectionsResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,7 +332,9 @@ 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" + } @distributed_trace def get( @@ -369,10 +366,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -385,10 +380,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -404,7 +400,9 @@ 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}" + } def _update_initial( self, @@ -426,16 +424,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") @@ -455,10 +451,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,7 +478,9 @@ 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}" + } @overload def begin_update( @@ -596,8 +595,8 @@ def begin_update( unique within the account. Required. :type private_endpoint_connection_name: str :param parameters: PrivateEndpointConnection properties that should be updated. Properties that - are supplied will be updated, any property not supplied will be unchanged. Is either a model - type or a IO type. Required. + are supplied will be updated, any property not supplied will be unchanged. Is either a + PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.batch.models.PrivateEndpointConnection or IO :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. Default value is @@ -622,16 +621,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -653,9 +650,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -667,9 +664,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -685,10 +684,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -701,10 +698,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -721,7 +719,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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 + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -752,13 +752,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -777,9 +775,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -791,6 +789,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.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}" + } 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 9afc6d083a89..464d3ca248d2 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +47,7 @@ def build_list_by_batch_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +63,7 @@ def build_list_by_batch_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +106,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,10 +158,8 @@ def list_by_batch_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPrivateLinkResourcesResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListPrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +183,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +199,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,14 +207,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListPrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,7 +227,9 @@ 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" + } @distributed_trace def get( @@ -265,10 +261,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -281,10 +275,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,4 +295,6 @@ 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}" + } diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_create.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_create.py index 294834370486..e1a764a45fb4 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_create.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_create.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationCreate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationCreate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_delete.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_delete.py index f4fb5b1aaaa6..4c1f8f89b021 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_delete.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.application.delete( + client.application.delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", application_name="app1", ) - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_get.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_get.py index 64633eae50f2..509c184ec858 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_get.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_list.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_list.py index a39d9180279d..31dde321175d 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_list.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_activate.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_activate.py index 7f11774894f8..1505a59868b9 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_activate.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_activate.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationPackageActivate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationPackageActivate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_create.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_create.py index e62847ab9e24..083b0797342c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_create.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationPackageCreate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationPackageCreate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_delete.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_delete.py index d63ef7692563..63d371c828b9 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_delete.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_delete.py @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.application_package.delete( + client.application_package.delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", application_name="app1", version_name="1", ) - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationPackageDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationPackageDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_get.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_get.py index 4233b79bdd16..9198adc8bd8e 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_get.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationPackageGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationPackageGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_list.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_list.py index a6eccc9cc105..dd10fa28a1c7 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_package_list.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_package_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationPackageList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationPackageList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/application_update.py b/sdk/batch/azure-mgmt-batch/generated_samples/application_update.py index b94e75507148..bc8cf40724f3 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/application_update.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/application_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/ApplicationUpdate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/ApplicationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_byos.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_byos.py index 90996ef13902..a00fc507630e 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_byos.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_byos.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountCreate_BYOS.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountCreate_BYOS.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_default.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_default.py index eb6780bb1d4a..710dce159409 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_default.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_default.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountCreate_Default.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountCreate_Default.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_system_assigned_identity.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_system_assigned_identity.py index f4f973d6256c..454e34c6954a 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_system_assigned_identity.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_system_assigned_identity.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountCreate_SystemAssignedIdentity.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountCreate_SystemAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_user_assigned_identity.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_user_assigned_identity.py index d1691f0242f4..30404d11791c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_user_assigned_identity.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_create_user_assigned_identity.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountCreate_UserAssignedIdentity.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountCreate_UserAssignedIdentity.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_delete.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_delete.py index 0b1b4326de51..0a237e166c84 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_delete.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.batch_account.begin_delete( + client.batch_account.begin_delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", ).result() - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get.py index 8253ffdb287d..bd832487fc05 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get_keys.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get_keys.py index 36a0782c4573..c5090f7d5d06 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get_keys.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_get_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountGetKeys.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountGetKeys.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list.py index cc3851f44234..4b6ff367aaa2 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_by_resource_group.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_by_resource_group.py index 376d4ef819f1..f3c91b53b81b 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_by_resource_group.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountListByResourceGroup.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_outbound_network_dependencies.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_outbound_network_dependencies_endpoints.py similarity index 91% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_outbound_network_dependencies.py rename to sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_outbound_network_dependencies_endpoints.py index a70131587aa1..fa179bb906d3 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_outbound_network_dependencies.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_list_outbound_network_dependencies_endpoints.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_outbound_network_dependencies.py + python batch_account_list_outbound_network_dependencies_endpoints.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_regenerate_key.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_regenerate_key.py index b7cd5dc6c0c8..189d16b362a4 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_regenerate_key.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountRegenerateKey.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_synchronize_auto_storage_keys.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_synchronize_auto_storage_keys.py index f22ead4ecff7..4643d4765423 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_synchronize_auto_storage_keys.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_synchronize_auto_storage_keys.py @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.batch_account.synchronize_auto_storage_keys( + client.batch_account.synchronize_auto_storage_keys( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", ) - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountSynchronizeAutoStorageKeys.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountSynchronizeAutoStorageKeys.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_update.py b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_update.py index 9b2505e9a3b3..6d3ed76b21d7 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_update.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/batch_account_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/BatchAccountUpdate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/BatchAccountUpdate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/certificate_cancel_deletion.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_cancel_deletion.py index 7e09bf40633e..3cfcc7b1831d 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/certificate_cancel_deletion.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_cancel_deletion.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateCancelDeletion.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateCancelDeletion.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__full.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_full.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__full.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_full.py index f303f0d70693..188fb5b8c13c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__full.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_full.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_certificate__full.py + python certificate_create_full.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateCreate_Full.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateCreate_Full.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_pfx.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_pfx.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal.py index f3c0e79fcee2..c308a5c2e778 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_pfx.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_certificate__minimal_pfx.py + python certificate_create_minimal.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateCreate_Minimal.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateCreate_Minimal.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_cer.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal_cer.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_cer.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal_cer.py index 27c80b59cf1f..0d4bf195b5e4 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_certificate__minimal_cer.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_create_minimal_cer.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_certificate__minimal_cer.py + python certificate_create_minimal_cer.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateCreate_MinimalCer.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateCreate_MinimalCer.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/certificate_delete.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_delete.py index ab1a9ccc3076..1512ecad6a0c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/certificate_delete.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.certificate.begin_delete( + client.certificate.begin_delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", certificate_name="sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", ).result() - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_certificate.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_get.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_certificate.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_get.py index 8b31a1fb6a12..633dc15a20f7 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_certificate.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_certificate.py + python certificate_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_certificate_with_deletion_error.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_get_with_deletion_error.py similarity index 92% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_certificate_with_deletion_error.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_get_with_deletion_error.py index 56a7152613da..24cd8e719b59 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_certificate_with_deletion_error.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_get_with_deletion_error.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_certificate_with_deletion_error.py + python certificate_get_with_deletion_error.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateGetWithDeletionError.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateGetWithDeletionError.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_certificates.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_list.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_certificates.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_list.py index 26d98b006073..3e004f2728d5 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_certificates.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_certificates.py + python certificate_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_certificates__filter_and_select.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_list_with_filter.py similarity index 92% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_certificates__filter_and_select.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_list_with_filter.py index 269cb679a109..0f52f9e01072 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_certificates__filter_and_select.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_certificates__filter_and_select.py + python certificate_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateListWithFilter.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_certificate.py b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_update.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_certificate.py rename to sdk/batch/azure-mgmt-batch/generated_samples/certificate_update.py index 539895a85323..56fc67c72de9 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_certificate.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/certificate_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_certificate.py + python certificate_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/CertificateUpdate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/CertificateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_detector.py b/sdk/batch/azure-mgmt-batch/generated_samples/detector_get.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_detector.py rename to sdk/batch/azure-mgmt-batch/generated_samples/detector_get.py index d36ed40c280a..c5314a137c00 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_detector.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/detector_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_detector.py + python detector_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/DetectorGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/DetectorGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_detectors.py b/sdk/batch/azure-mgmt-batch/generated_samples/detector_list.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_detectors.py rename to sdk/batch/azure-mgmt-batch/generated_samples/detector_list.py index 8a23dae29646..ab892a812094 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_detectors.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/detector_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_detectors.py + python detector_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/DetectorList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/DetectorList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_already_exists.py b/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_already_exists.py index e1faa5d7db30..015c1379ee1b 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_already_exists.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_already_exists.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/LocationCheckNameAvailability_AlreadyExists.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/LocationCheckNameAvailability_AlreadyExists.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_available.py b/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_available.py index da0487e406fe..bd67190cabd3 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_available.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/location_check_name_availability_available.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/LocationCheckNameAvailability_Available.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/LocationCheckNameAvailability_Available.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/location_get_quotas.py b/sdk/batch/azure-mgmt-batch/generated_samples/location_get_quotas.py index 25a2cd47e5be..f573f203a123 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/location_get_quotas.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/location_get_quotas.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/LocationGetQuotas.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/LocationGetQuotas.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/location_list_cloud_service_skus.py b/sdk/batch/azure-mgmt-batch/generated_samples/location_list_cloud_service_skus.py index ebdd1afa0ff5..1dce36c338d8 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/location_list_cloud_service_skus.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/location_list_cloud_service_skus.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/LocationListCloudServiceSkus.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/LocationListCloudServiceSkus.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/location_list_virtual_machine_skus.py b/sdk/batch/azure-mgmt-batch/generated_samples/location_list_virtual_machine_skus.py index b766e122317b..260144efdc8c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/location_list_virtual_machine_skus.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/location_list_virtual_machine_skus.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/LocationListVirtualMachineSkus.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/LocationListVirtualMachineSkus.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/operations_list.py b/sdk/batch/azure-mgmt-batch/generated_samples/operations_list.py index 199b758ae833..0c543a2d1e37 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/operations_list.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/OperationsList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_accelerated_networking.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_accelerated_networking.py new file mode 100644 index 000000000000..2cb3cfd57e3b --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_accelerated_networking.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.batch import BatchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-batch +# USAGE + python pool_create_accelerated_networking.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BatchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.pool.create( + resource_group_name="default-azurebatch-japaneast", + account_name="sampleacct", + pool_name="testpool", + parameters={ + "properties": { + "deploymentConfiguration": { + "virtualMachineConfiguration": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-datacenter-smalldisk", + "version": "latest", + }, + "nodeAgentSkuId": "batch.node.windows amd64", + } + }, + "networkConfiguration": { + "enableAcceleratedNetworking": True, + "subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123", + }, + "scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}}, + "vmSize": "STANDARD_D1_V2", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_AcceleratedNetworking.json +if __name__ == "__main__": + main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_cloud_service_configuration.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_cloud_service_configuration.py similarity index 97% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_cloud_service_configuration.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_cloud_service_configuration.py index c9494f71a76a..28ee6d70efff 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_cloud_service_configuration.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_cloud_service_configuration.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__full_cloud_service_configuration.py + python pool_create_cloud_service_configuration.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -105,6 +105,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_CloudServiceConfiguration.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_CloudServiceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_cloud_service_configuration.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_cloud_service_configuration.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_cloud_service_configuration.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_cloud_service_configuration.py index 91390e466a2d..6f9b0ace6f4d 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_cloud_service_configuration.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_cloud_service_configuration.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__minimal_cloud_service_configuration.py + python pool_create_minimal_cloud_service_configuration.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_virtual_machine_configuration.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_virtual_machine_configuration.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_virtual_machine_configuration.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_virtual_machine_configuration.py index 6962ecdf29dd..7c927dd42597 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__minimal_virtual_machine_configuration.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_minimal_virtual_machine_configuration.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__minimal_virtual_machine_configuration.py + python pool_create_minimal_virtual_machine_configuration.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__no_public_ip.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_no_public_ip_addresses.py similarity index 95% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__no_public_ip.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_no_public_ip_addresses.py index 2b2fc073a4aa..52f9bd81637c 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__no_public_ip.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_no_public_ip_addresses.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__no_public_ip.py + python pool_create_no_public_ip_addresses.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_NoPublicIPAddresses.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_NoPublicIPAddresses.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__public_ips.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_public_ips.py similarity index 96% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__public_ips.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_public_ips.py index 4bd64b7807ac..67d9feee0abb 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__public_ips.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_public_ips.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__public_ips.py + python pool_create_public_ips.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_PublicIPs.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_PublicIPs.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__custom_image.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_shared_image_gallery.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__custom_image.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_shared_image_gallery.py index 890b668749d8..a1aa3df94346 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__custom_image.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_shared_image_gallery.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__custom_image.py + python pool_create_shared_image_gallery.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_SharedImageGallery.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_SharedImageGallery.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__user_assigned_identities.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_user_assigned_identities.py similarity index 95% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__user_assigned_identities.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_user_assigned_identities.py index 39ea3f23d694..5ef2e71cbf3e 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__user_assigned_identities.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_user_assigned_identities.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__user_assigned_identities.py + python pool_create_user_assigned_identities.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_UserAssignedIdentities.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_UserAssignedIdentities.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_virtual_machine_configuration.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration.py similarity index 97% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_virtual_machine_configuration.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration.py index 320b3cd18fc7..b9d73df2ae11 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__full_virtual_machine_configuration.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__full_virtual_machine_configuration.py + python pool_create_virtual_machine_configuration.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -90,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_VirtualMachineConfiguration.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_VirtualMachineConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__virtual_machine_configuration_extensions.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration_extensions.py similarity index 78% rename from sdk/batch/azure-mgmt-batch/generated_samples/create_pool__virtual_machine_configuration_extensions.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration_extensions.py index 2c2ea4876475..e28102838674 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/create_pool__virtual_machine_configuration_extensions.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_create_virtual_machine_configuration_extensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python create_pool__virtual_machine_configuration_extensions.py + python pool_create_virtual_machine_configuration_extensions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -40,12 +40,15 @@ def main(): "extensions": [ { "autoUpgradeMinorVersion": True, + "enableAutomaticUpgrade": True, "name": "batchextension1", - "protectedSettings": {"protectedSettingsKey": "protectedSettingsValue"}, - "publisher": "Microsoft.Azure.Security.Monitoring", - "settings": {"settingsKey": "settingsValue"}, - "type": "SecurityMonitoringForLinux", - "typeHandlerVersion": "1.0", + "publisher": "Microsoft.Azure.KeyVault", + "settings": { + "authenticationSettingsKey": "authenticationSettingsValue", + "secretsManagementSettingsKey": "secretsManagementSettingsValue", + }, + "type": "KeyVaultForLinux", + "typeHandlerVersion": "2.0", } ], "imageReference": { @@ -65,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/delete_pool.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_delete.py similarity index 90% rename from sdk/batch/azure-mgmt-batch/generated_samples/delete_pool.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_delete.py index 74cdf9c42212..a7e762213fbf 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/delete_pool.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python delete_pool.py + python pool_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.pool.begin_delete( + client.pool.begin_delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", pool_name="testpool", ).result() - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/disable_auto_scale.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_disable_auto_scale.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/disable_auto_scale.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_disable_auto_scale.py index bce6cc84006e..0a68c5a36664 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/disable_auto_scale.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_disable_auto_scale.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python disable_auto_scale.py + python pool_disable_auto_scale.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolDisableAutoScale.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolDisableAutoScale.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_pool.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get.py similarity index 95% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_pool.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_get.py index 8916cab7de10..4574f30607df 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_pool.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_pool.py + python pool_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/pool_get_accelerated_networking.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get_accelerated_networking.py new file mode 100644 index 000000000000..41d4cceb7098 --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get_accelerated_networking.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.batch import BatchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-batch +# USAGE + python pool_get_accelerated_networking.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BatchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.pool.get( + resource_group_name="default-azurebatch-japaneast", + account_name="sampleacct", + pool_name="testpool", + ) + print(response) + + +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolGet_AcceleratedNetworking.json +if __name__ == "__main__": + main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_pool__virtual_machine_configuration_extensions.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get_virtual_machine_configuration_extensions.py similarity index 91% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_pool__virtual_machine_configuration_extensions.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_get_virtual_machine_configuration_extensions.py index 2e07cc4845a5..0193cfcf82ac 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_pool__virtual_machine_configuration_extensions.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_get_virtual_machine_configuration_extensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_pool__virtual_machine_configuration_extensions.py + python pool_get_virtual_machine_configuration_extensions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolGet_VirtualMachineConfiguration_Extensions.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolGet_VirtualMachineConfiguration_Extensions.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_pool.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_list.py similarity index 95% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_pool.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_list.py index 64cfccf46176..bba7cdff8045 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_pool.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_pool.py + python pool_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_pool_with_filter.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_list_with_filter.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_pool_with_filter.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_list_with_filter.py index dee4c3472184..7ee019b59a4e 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_pool_with_filter.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_pool_with_filter.py + python pool_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolListWithFilter.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/stop_pool_resize.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_stop_resize.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/stop_pool_resize.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_stop_resize.py index 199050954ac7..645e5873aec2 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/stop_pool_resize.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_stop_resize.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python stop_pool_resize.py + python pool_stop_resize.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolStopResize.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolStopResize.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__enable_autoscale.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_enable_auto_scale.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_pool__enable_autoscale.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_update_enable_auto_scale.py index ec6de6d64b8d..d6899089d283 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__enable_autoscale.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_enable_auto_scale.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_pool__enable_autoscale.py + python pool_update_enable_auto_scale.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolUpdate_EnableAutoScale.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolUpdate_EnableAutoScale.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__other_properties.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_other_properties.py similarity index 96% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_pool__other_properties.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_update_other_properties.py index 3dade8a42359..5826eec03270 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__other_properties.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_other_properties.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_pool__other_properties.py + python pool_update_other_properties.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolUpdate_OtherProperties.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolUpdate_OtherProperties.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__remove_start_task.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_remove_start_task.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_pool__remove_start_task.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_update_remove_start_task.py index 5fc6eafaf689..e918e304c613 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__remove_start_task.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_remove_start_task.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_pool__remove_start_task.py + python pool_update_remove_start_task.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolUpdate_RemoveStartTask.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolUpdate_RemoveStartTask.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__resize_pool.py b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_resize_pool.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_pool__resize_pool.py rename to sdk/batch/azure-mgmt-batch/generated_samples/pool_update_resize_pool.py index 491b78d9a48d..1583ec38fc09 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_pool__resize_pool.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/pool_update_resize_pool.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_pool__resize_pool.py + python pool_update_resize_pool.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PoolUpdate_ResizePool.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PoolUpdate_ResizePool.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_create.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_create.py index 4fda4ddc1b4c..083194b8f586 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_create.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_create.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateBatchAccountCreate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateBatchAccountCreate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_get.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_get.py index fe9aae74896f..1801843b673d 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_get.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_batch_account_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateBatchAccountGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateBatchAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_delete.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_delete.py index 7338238e45b6..6a7998210423 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.private_endpoint_connection.begin_delete( + client.private_endpoint_connection.begin_delete( resource_group_name="default-azurebatch-japaneast", account_name="sampleacct", private_endpoint_connection_name="testprivateEndpointConnection5testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0", ).result() - print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_private_endpoint_connection.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_get.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_private_endpoint_connection.py rename to sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_get.py index 51c563d97c00..fbdf614712df 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_private_endpoint_connection.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_private_endpoint_connection.py + python private_endpoint_connection_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/update_private_endpoint_connection.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_update.py similarity index 94% rename from sdk/batch/azure-mgmt-batch/generated_samples/update_private_endpoint_connection.py rename to sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_update.py index 69a42217711f..b7101d7ed5ed 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/update_private_endpoint_connection.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connection_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python update_private_endpoint_connection.py + python private_endpoint_connection_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_private_endpoint_connections.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connections_list.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_private_endpoint_connections.py rename to sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connections_list.py index d189b5856f81..b0b971b153f3 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_private_endpoint_connections.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_endpoint_connections_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_private_endpoint_connections.py + python private_endpoint_connections_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateEndpointConnectionsList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateEndpointConnectionsList.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/get_private_link_resource.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_link_resource_get.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/get_private_link_resource.py rename to sdk/batch/azure-mgmt-batch/generated_samples/private_link_resource_get.py index c5a50a8ff94f..f1181b22c6b0 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/get_private_link_resource.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_link_resource_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python get_private_link_resource.py + python private_link_resource_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateLinkResourceGet.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/batch/azure-mgmt-batch/generated_samples/list_private_link_resource.py b/sdk/batch/azure-mgmt-batch/generated_samples/private_link_resources_list.py similarity index 93% rename from sdk/batch/azure-mgmt-batch/generated_samples/list_private_link_resource.py rename to sdk/batch/azure-mgmt-batch/generated_samples/private_link_resources_list.py index 052a8a3b0679..00073dd4b2e9 100644 --- a/sdk/batch/azure-mgmt-batch/generated_samples/list_private_link_resource.py +++ b/sdk/batch/azure-mgmt-batch/generated_samples/private_link_resources_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-batch # USAGE - python list_private_link_resource.py + python private_link_resources_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/examples/PrivateLinkResourcesList.json +# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/examples/PrivateLinkResourcesList.json if __name__ == "__main__": main()