From 9a754eec2b20c21aa3865f743cb3012fcc6e8b76 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 6 Mar 2023 10:24:49 +0000 Subject: [PATCH] CodeGen from PR 22638 in Azure/azure-rest-api-specs Merge 7b68ec0266ff62dcc10051f1f87856a539f6fc7d into b0a96087a75bc286a7e2735f71872d63692c7baa --- sdk/elastic/azure-mgmt-elastic/_meta.json | 6 +- .../azure/mgmt/elastic/__init__.py | 2 +- .../azure/mgmt/elastic/_configuration.py | 9 +- .../azure/mgmt/elastic/_microsoft_elastic.py | 19 +- .../azure/mgmt/elastic/_serialization.py | 174 +++++++----- .../azure/mgmt/elastic/_vendor.py | 5 +- .../azure/mgmt/elastic/_version.py | 2 +- .../azure/mgmt/elastic/aio/__init__.py | 2 +- .../azure/mgmt/elastic/aio/_configuration.py | 4 +- .../mgmt/elastic/aio/_microsoft_elastic.py | 12 +- .../mgmt/elastic/aio/operations/__init__.py | 4 +- .../_all_traffic_filters_operations.py | 14 +- .../_associate_traffic_filter_operations.py | 34 ++- ...eate_and_associate_ip_filter_operations.py | 36 ++- ...eate_and_associate_pl_filter_operations.py | 36 ++- .../operations/_deployment_info_operations.py | 14 +- ...ch_and_delete_traffic_filter_operations.py | 14 +- .../_detach_traffic_filter_operations.py | 34 ++- .../operations/_external_user_operations.py | 20 +- ...t_associated_traffic_filters_operations.py | 14 +- .../aio/operations/_monitor_operations.py | 40 +-- .../_monitored_resources_operations.py | 18 +- .../aio/operations/_monitors_operations.py | 148 +++++----- .../elastic/aio/operations/_operations.py | 16 +- .../operations/_organizations_operations.py | 206 ++++++++++++++ .../aio/operations/_tag_rules_operations.py | 84 +++--- .../operations/_traffic_filters_operations.py | 14 +- .../_upgradable_versions_operations.py | 14 +- .../operations/_vm_collection_operations.py | 19 +- .../aio/operations/_vm_host_operations.py | 18 +- .../operations/_vm_ingestion_operations.py | 14 +- .../azure/mgmt/elastic/models/__init__.py | 12 +- .../models/_microsoft_elastic_enums.py | 10 - .../azure/mgmt/elastic/models/_models_py3.py | 261 +++++++++++++----- .../azure/mgmt/elastic/operations/__init__.py | 4 +- .../_all_traffic_filters_operations.py | 22 +- .../_associate_traffic_filter_operations.py | 42 +-- ...eate_and_associate_ip_filter_operations.py | 44 +-- ...eate_and_associate_pl_filter_operations.py | 44 +-- .../operations/_deployment_info_operations.py | 22 +- ...ch_and_delete_traffic_filter_operations.py | 22 +- .../_detach_traffic_filter_operations.py | 42 +-- .../operations/_external_user_operations.py | 30 +- ...t_associated_traffic_filters_operations.py | 22 +- .../elastic/operations/_monitor_operations.py | 50 ++-- .../_monitored_resources_operations.py | 26 +- .../operations/_monitors_operations.py | 200 +++++++------- .../mgmt/elastic/operations/_operations.py | 22 +- .../operations/_organizations_operations.py | 242 ++++++++++++++++ .../operations/_tag_rules_operations.py | 118 ++++---- .../operations/_traffic_filters_operations.py | 22 +- .../_upgradable_versions_operations.py | 22 +- .../operations/_vm_collection_operations.py | 29 +- .../elastic/operations/_vm_host_operations.py | 26 +- .../operations/_vm_ingestion_operations.py | 22 +- .../all_traffic_filters_list.py | 2 +- ....py => associate_traffic_filter_update.py} | 4 +- ...associated_filters_for_deployment_list.py} | 4 +- .../generated_samples/deployment_info_list.py | 2 +- ...detach_and_delete_traffic_filter_delete.py | 2 +- ...te.py => detach_traffic_filters_update.py} | 4 +- ...ate_or_update.py => external_user_info.py} | 4 +- ..._create.py => ip_traffic_filter_create.py} | 4 +- .../generated_samples/monitor_upgrade.py | 2 +- .../monitored_resources_list.py | 2 +- .../generated_samples/monitors_create.py | 2 +- .../generated_samples/monitors_delete.py | 2 +- .../generated_samples/monitors_get.py | 2 +- .../generated_samples/monitors_list.py | 2 +- .../monitors_list_by_resource_group.py | 2 +- .../generated_samples/monitors_update.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../organizations_get_api_key.py | 40 +++ ...=> private_link_traffic_filters_create.py} | 4 +- .../tag_rules_create_or_update.py | 2 +- .../generated_samples/tag_rules_delete.py | 2 +- .../generated_samples/tag_rules_get.py | 2 +- .../generated_samples/tag_rules_list.py | 2 +- .../traffic_filters_delete.py | 2 +- .../upgradable_versions_details.py | 2 +- .../generated_samples/vm_collection_update.py | 2 +- .../generated_samples/vm_host_list.py | 2 +- .../generated_samples/vm_ingestion_details.py | 2 +- 83 files changed, 1654 insertions(+), 854 deletions(-) create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py rename sdk/elastic/azure-mgmt-elastic/generated_samples/{associate_traffic_filter_associate.py => associate_traffic_filter_update.py} (92%) rename sdk/elastic/azure-mgmt-elastic/generated_samples/{list_associated_traffic_filters_list.py => associated_filters_for_deployment_list.py} (92%) rename sdk/elastic/azure-mgmt-elastic/generated_samples/{detach_traffic_filter_update.py => detach_traffic_filters_update.py} (93%) rename sdk/elastic/azure-mgmt-elastic/generated_samples/{external_user_create_or_update.py => external_user_info.py} (93%) rename sdk/elastic/azure-mgmt-elastic/generated_samples/{create_and_associate_ip_filter_create.py => ip_traffic_filter_create.py} (92%) create mode 100644 sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py rename sdk/elastic/azure-mgmt-elastic/generated_samples/{create_and_associate_pl_filter_create.py => private_link_traffic_filters_create.py} (92%) diff --git a/sdk/elastic/azure-mgmt-elastic/_meta.json b/sdk/elastic/azure-mgmt-elastic/_meta.json index 7641b42d9b40..ed99deb6e9fd 100644 --- a/sdk/elastic/azure-mgmt-elastic/_meta.json +++ b/sdk/elastic/azure-mgmt-elastic/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4903b1ed79e30f689d7c469cfa06734cfcd106d6", + "commit": "5ea47ca684fc717dd98e74c8baa46825080f8708", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/elastic/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/elastic/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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/elastic/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py index b960c57432b7..a9ab412a5f83 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py index c9faee9d8de9..c4306dd8c113 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py @@ -36,14 +36,14 @@ class MicrosoftElasticConfiguration(Configuration): # pylint: disable=too-many- :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-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-02-01-preview". 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(MicrosoftElasticConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop("api_version", "2023-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-elastic/{}".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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py index b49b5ebeb02a..616ca3c87d51 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.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 MicrosoftElasticConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -29,6 +29,7 @@ MonitoredResourcesOperations, MonitorsOperations, Operations, + OrganizationsOperations, TagRulesOperations, TrafficFiltersOperations, UpgradableVersionsOperations, @@ -88,6 +89,8 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype detach_traffic_filter: azure.mgmt.elastic.operations.DetachTrafficFilterOperations :ivar traffic_filters: TrafficFiltersOperations operations :vartype traffic_filters: azure.mgmt.elastic.operations.TrafficFiltersOperations + :ivar organizations: OrganizationsOperations operations + :vartype organizations: azure.mgmt.elastic.operations.OrganizationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. @@ -95,7 +98,7 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :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-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-02-01-preview". 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 @@ -112,7 +115,7 @@ def __init__( self._config = MicrosoftElasticConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -153,6 +156,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.traffic_filters = TrafficFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -176,15 +180,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: () -> MicrosoftElastic + def __enter__(self) -> "MicrosoftElastic": 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py index 7c1dedb5133d..f17c068e833e 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_serialization.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_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 @@ -606,13 +630,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + 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 @@ -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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py index 653b73a4a199..e5754a47ce68 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py index 9b1f32c1bf6d..f09378ce2fff 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py index b31caa8f7cad..77949d38a80b 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py @@ -36,14 +36,14 @@ class MicrosoftElasticConfiguration(Configuration): # pylint: disable=too-many- :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-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-02-01-preview". 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(MicrosoftElasticConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop("api_version", "2023-02-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py index 7b4d59e620b8..34482252d82d 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.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 MicrosoftElasticConfiguration from .operations import ( @@ -29,6 +29,7 @@ MonitoredResourcesOperations, MonitorsOperations, Operations, + OrganizationsOperations, TagRulesOperations, TrafficFiltersOperations, UpgradableVersionsOperations, @@ -88,6 +89,8 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :vartype detach_traffic_filter: azure.mgmt.elastic.aio.operations.DetachTrafficFilterOperations :ivar traffic_filters: TrafficFiltersOperations operations :vartype traffic_filters: azure.mgmt.elastic.aio.operations.TrafficFiltersOperations + :ivar organizations: OrganizationsOperations operations + :vartype organizations: azure.mgmt.elastic.aio.operations.OrganizationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. @@ -95,7 +98,7 @@ class MicrosoftElastic: # pylint: disable=client-accepts-api-version-keyword,to :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-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-02-01-preview". 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 @@ -112,7 +115,7 @@ def __init__( self._config = MicrosoftElasticConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -153,6 +156,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.traffic_filters = TrafficFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -183,5 +187,5 @@ async def __aenter__(self) -> "MicrosoftElastic": 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py index 58ff8e477e4d..47af29eeb877 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/__init__.py @@ -25,9 +25,10 @@ from ._detach_and_delete_traffic_filter_operations import DetachAndDeleteTrafficFilterOperations from ._detach_traffic_filter_operations import DetachTrafficFilterOperations from ._traffic_filters_operations import TrafficFiltersOperations +from ._organizations_operations import OrganizationsOperations 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__ = [ @@ -50,6 +51,7 @@ "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", "TrafficFiltersOperations", + "OrganizationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py index b296846089d9..8360367a1e92 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_all_traffic_filters_operations.py @@ -84,10 +84,10 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticTrafficFilterResponse] + ) + cls: ClsType[_models.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -99,9 +99,9 @@ async def list( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +121,6 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py index 56120e832aae..c3970c9900e0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_associate_traffic_filter_operations.py @@ -71,10 +71,10 @@ async def _associate_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_associate_request( resource_group_name=resource_group_name, @@ -87,9 +87,9 @@ async def _associate_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,9 @@ async def _associate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _associate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter"} # type: ignore + _associate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + } @distributed_trace_async async def begin_associate( @@ -137,13 +139,13 @@ async def begin_associate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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._associate_initial( # type: ignore resource_group_name=resource_group_name, @@ -162,7 +164,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -174,6 +178,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_associate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter"} # type: ignore + begin_associate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py index 428a52af84c2..bd66c675f553 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_ip_filter_operations.py @@ -76,10 +76,10 @@ async def _create_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -93,15 +93,15 @@ async def _create_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.ResourceProviderDefaultErrorResponse, pipeline_response @@ -111,7 +111,9 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + } @distributed_trace_async async def begin_create( @@ -150,13 +152,13 @@ async def begin_create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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._create_initial( # type: ignore resource_group_name=resource_group_name, @@ -176,7 +178,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -188,6 +192,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_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py index 69bcdd4b46fa..bcf6c2d80156 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_create_and_associate_pl_filter_operations.py @@ -77,10 +77,10 @@ async def _create_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -95,15 +95,15 @@ async def _create_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.ResourceProviderDefaultErrorResponse, pipeline_response @@ -113,7 +113,9 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + } @distributed_trace_async async def begin_create( @@ -155,13 +157,13 @@ async def begin_create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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._create_initial( # type: ignore resource_group_name=resource_group_name, @@ -182,7 +184,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -194,6 +198,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_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py index 859ae08a8822..2f63212dafcd 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py @@ -84,10 +84,10 @@ async def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeploymentInfoResponse] + ) + cls: ClsType[_models.DeploymentInfoResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -99,9 +99,9 @@ async def list(self, resource_group_name: str, monitor_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +121,6 @@ async def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py index fb8e2ba6cd8e..a898bf40a097 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_and_delete_traffic_filter_operations.py @@ -86,10 +86,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -102,9 +102,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -120,4 +120,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py index 2d14fbcce521..9f157782d2ce 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_detach_traffic_filter_operations.py @@ -71,10 +71,10 @@ async def _update_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_request( resource_group_name=resource_group_name, @@ -87,9 +87,9 @@ async def _update_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,7 +105,9 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + } @distributed_trace_async async def begin_update( @@ -137,13 +139,13 @@ async def begin_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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._update_initial( # type: ignore resource_group_name=resource_group_name, @@ -162,7 +164,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -174,6 +178,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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py index 57cd06f5e5f9..e2c0fdec414e 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_external_user_operations.py @@ -138,8 +138,8 @@ async def create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic External User Creation Parameters. Is either a model type or a IO type. - Default value is None. + :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a + IO type. Default value is None. :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -160,11 +160,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalUserCreationResponse] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -190,9 +190,9 @@ async def create_or_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,4 +212,6 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py index 34a4bd02cc72..dc6e4691dd67 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_list_associated_traffic_filters_operations.py @@ -84,10 +84,10 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticTrafficFilterResponse] + ) + cls: ClsType[_models.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -99,9 +99,9 @@ async def list( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +121,6 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py index 84bb0ce4f98e..05651179d04a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitor_operations.py @@ -75,11 +75,11 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -105,9 +105,9 @@ async def _upgrade_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -123,7 +123,9 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _upgrade_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade"} # type: ignore + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + } @overload async def begin_upgrade( @@ -216,8 +218,8 @@ async def begin_upgrade( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Is either a model type or a IO type. Default - value is None. + :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -237,14 +239,14 @@ async def begin_upgrade( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._upgrade_initial( # type: ignore resource_group_name=resource_group_name, @@ -264,7 +266,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -276,6 +278,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_upgrade.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade"} # type: ignore + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py index 79d3c25e429f..5941be629802 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py @@ -78,10 +78,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoredResourceListResponse] + ) + cls: ClsType[_models.MonitoredResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +104,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 @@ -120,7 +120,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 @@ -128,13 +128,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MonitoredResourceListResponse", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -150,4 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py index 98e1b53d9d5f..81083c9434e8 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py @@ -83,10 +83,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ElasticMonitorResource"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResourceListResponse] + ) + cls: ClsType[_models.ElasticMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,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 @@ -123,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 @@ -131,13 +131,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors"} @distributed_trace def list_by_resource_group( @@ -176,10 +176,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResourceListResponse] + ) + cls: ClsType[_models.ElasticMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -201,7 +201,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 @@ -217,7 +217,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 @@ -225,13 +225,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -247,7 +247,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.Elastic/monitors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + } @distributed_trace_async async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: @@ -276,10 +278,10 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -291,9 +293,9 @@ async def get(self, resource_group_name: str, monitor_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -313,7 +315,9 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } async def _create_initial( self, @@ -333,11 +337,11 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,9 +367,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -385,11 +389,13 @@ async def _create_initial( deserialized = self._deserialize("ElasticMonitorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @overload async def begin_create( @@ -484,8 +490,8 @@ async def begin_create( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic monitor resource model. Is either a model type or a IO type. Default value - is None. + :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -506,16 +512,16 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = 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, monitor_name=monitor_name, body=body, @@ -535,10 +541,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: @@ -550,9 +556,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.Elastic/monitors/{monitorName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @overload async def update( @@ -631,8 +639,8 @@ async def update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic resource model update parameters. Is either a model type or a IO type. - Default value is None. + :param body: Elastic resource model update parameters. Is either a + ElasticMonitorResourceUpdateParameters type or a IO type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -653,11 +661,11 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -683,9 +691,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -705,7 +713,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, **kwargs: Any @@ -721,10 +731,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -736,9 +746,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -754,7 +764,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -782,13 +794,13 @@ async def begin_delete(self, resource_group_name: str, monitor_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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, @@ -806,7 +818,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -818,6 +830,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.Elastic/monitors/{monitorName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py index 8efb5c91087f..628d21d03f78 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py @@ -71,10 +71,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +94,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 @@ -110,7 +110,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 @@ -118,13 +118,13 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -140,4 +140,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Elastic/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Elastic/operations"} diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py new file mode 100644 index 000000000000..eb31cd903b7f --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_organizations_operations.py @@ -0,0 +1,206 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._organizations_operations import build_get_api_key_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]] + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.aio.MicrosoftElastic`'s + :attr:`organizations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get_api_key( + self, + resource_group_name: str, + body: Optional[_models.UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_api_key( + self, + resource_group_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_api_key( + self, resource_group_name: str, body: Optional[Union[_models.UserEmailId, IO]] = None, **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Is either a UserEmailId type or a IO type. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-02-01-preview"] = 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.UserApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "UserEmailId") + else: + _json = None + + request = build_get_api_key_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_api_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UserApiKeyResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_api_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/getOrganizationApiKey" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py index 0adbba8bdb9a..c5f39d75f113 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py @@ -86,10 +86,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRulesListResponse] + ) + cls: ClsType[_models.MonitoringTagRulesListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +112,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 @@ -128,7 +128,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 @@ -136,13 +136,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MonitoringTagRulesListResponse", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -158,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules" + } @overload async def create_or_update( @@ -246,8 +248,8 @@ async def create_or_update( :type monitor_name: str :param rule_set_name: Tag Rule Set resource name. Required. :type rule_set_name: str - :param body: request body of MonitoringTagRules. Is either a model type or a IO type. Default - value is None. + :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -268,11 +270,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -299,9 +301,9 @@ async def create_or_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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +323,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace_async async def get( @@ -354,10 +358,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + ) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -370,9 +374,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -392,7 +396,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any @@ -408,10 +414,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -424,9 +430,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -442,7 +448,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace_async async def begin_delete( @@ -474,13 +482,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + 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, @@ -499,7 +507,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -511,6 +519,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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py index 80e894ac5c2c..380629602ac2 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_traffic_filters_operations.py @@ -86,10 +86,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -102,9 +102,9 @@ 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -120,4 +120,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py index 4ac916364a17..8bb6a24d0974 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_upgradable_versions_operations.py @@ -84,10 +84,10 @@ async def details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UpgradableVersionsList] + ) + cls: ClsType[_models.UpgradableVersionsList] = kwargs.pop("cls", None) request = build_details_request( resource_group_name=resource_group_name, @@ -99,9 +99,9 @@ async def details( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +121,6 @@ async def details( return deserialized - details.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions"} # type: ignore + details.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py index 44d006b026f8..67d7e1c76e1a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py @@ -132,7 +132,8 @@ async def update( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: VM resource Id. Is either a model type or a IO type. Default value is None. + :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO type. Default value is + None. :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -153,11 +154,11 @@ async def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -183,9 +184,9 @@ async def update( # 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -201,4 +202,6 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py index 989065ec8726..3fe713fb8555 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py @@ -76,10 +76,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VMHostListResponse] + ) + cls: ClsType[_models.VMHostListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +102,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 @@ -118,7 +118,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 @@ -126,13 +126,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("VMHostListResponse", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,4 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py index 7b78a21e1de8..3fd1ddfd7064 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py @@ -84,10 +84,10 @@ async def details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VMIngestionDetailsResponse] + ) + cls: ClsType[_models.VMIngestionDetailsResponse] = kwargs.pop("cls", None) request = build_details_request( resource_group_name=resource_group_name, @@ -99,9 +99,9 @@ async def details( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +121,6 @@ async def details( return deserialized - details.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails"} # type: ignore + details.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py index 3df374e42bc7..f8d2fca85950 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py @@ -24,6 +24,8 @@ from ._models_py3 import FilteringTag from ._models_py3 import IdentityProperties from ._models_py3 import LogRules +from ._models_py3 import MarketplaceSaaSInfo +from ._models_py3 import MarketplaceSaaSInfoMarketplaceSubscription from ._models_py3 import MonitorProperties from ._models_py3 import MonitoredResource from ._models_py3 import MonitoredResourceListResponse @@ -37,13 +39,14 @@ from ._models_py3 import ResourceSku from ._models_py3 import SystemData from ._models_py3 import UpgradableVersionsList +from ._models_py3 import UserApiKeyResponse +from ._models_py3 import UserEmailId from ._models_py3 import UserInfo from ._models_py3 import VMCollectionUpdate from ._models_py3 import VMHostListResponse from ._models_py3 import VMIngestionDetailsResponse from ._models_py3 import VMResources -from ._microsoft_elastic_enums import ApiVersionParameter from ._microsoft_elastic_enums import CreatedByType from ._microsoft_elastic_enums import ElasticDeploymentStatus from ._microsoft_elastic_enums import LiftrResourceCategories @@ -55,7 +58,7 @@ from ._microsoft_elastic_enums import TagAction from ._microsoft_elastic_enums import Type 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__ = [ @@ -77,6 +80,8 @@ "FilteringTag", "IdentityProperties", "LogRules", + "MarketplaceSaaSInfo", + "MarketplaceSaaSInfoMarketplaceSubscription", "MonitorProperties", "MonitoredResource", "MonitoredResourceListResponse", @@ -90,12 +95,13 @@ "ResourceSku", "SystemData", "UpgradableVersionsList", + "UserApiKeyResponse", + "UserEmailId", "UserInfo", "VMCollectionUpdate", "VMHostListResponse", "VMIngestionDetailsResponse", "VMResources", - "ApiVersionParameter", "CreatedByType", "ElasticDeploymentStatus", "LiftrResourceCategories", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py index 398a73bd38ac..bdb8db0b2e09 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py @@ -10,16 +10,6 @@ from azure.core import CaseInsensitiveEnumMeta -class ApiVersionParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ApiVersionParameter.""" - - TWO_THOUSAND_TWENTY07_01_PREVIEW = "2020-07-01-preview" - TWO_THOUSAND_TWENTY07_01 = "2020-07-01" - TWO_THOUSAND_TWENTY_ONE09_01_PREVIEW = "2021-09-01-preview" - TWO_THOUSAND_TWENTY_ONE10_01_PREVIEW = "2021-10-01-preview" - TWO_THOUSAND_TWENTY_TWO05_05_PREVIEW = "2022-05-05-preview" - - class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py index 8042b6c9fb11..5d666c878e62 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -34,10 +34,10 @@ class CompanyInfo(_serialization.Model): _validation = { "domain": {"max_length": 250}, - "business": {"max_length": 50}, + "business": {"max_length": 64}, "employees_number": {"max_length": 20}, - "state": {"max_length": 50}, - "country": {"max_length": 50}, + "state": {"max_length": 64}, + "country": {"max_length": 64}, } _attribute_map = { @@ -56,8 +56,8 @@ def __init__( employees_number: Optional[str] = None, state: Optional[str] = None, country: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain: Domain of the company. :paramtype domain: str @@ -91,6 +91,10 @@ class DeploymentInfoResponse(_serialization.Model): :vartype memory_capacity: str :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. :vartype disk_capacity: str + :ivar deployment_url: Deployment URL of the elasticsearch in Elastic cloud deployment. + :vartype deployment_url: str + :ivar marketplace_saas_info: Marketplace SaaS Info of the resource. + :vartype marketplace_saas_info: ~azure.mgmt.elastic.models.MarketplaceSaaSInfo """ _validation = { @@ -98,6 +102,8 @@ class DeploymentInfoResponse(_serialization.Model): "version": {"readonly": True}, "memory_capacity": {"readonly": True}, "disk_capacity": {"readonly": True}, + "deployment_url": {"readonly": True}, + "marketplace_saas_info": {"readonly": True}, } _attribute_map = { @@ -105,15 +111,19 @@ class DeploymentInfoResponse(_serialization.Model): "version": {"key": "version", "type": "str"}, "memory_capacity": {"key": "memoryCapacity", "type": "str"}, "disk_capacity": {"key": "diskCapacity", "type": "str"}, + "deployment_url": {"key": "deploymentUrl", "type": "str"}, + "marketplace_saas_info": {"key": "marketplaceSaasInfo", "type": "MarketplaceSaaSInfo"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None self.version = None self.memory_capacity = None self.disk_capacity = None + self.deployment_url = None + self.marketplace_saas_info = None class ElasticCloudDeployment(_serialization.Model): @@ -157,7 +167,7 @@ class ElasticCloudDeployment(_serialization.Model): "kibana_sso_url": {"key": "kibanaSsoUrl", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -195,7 +205,7 @@ class ElasticCloudUser(_serialization.Model): "elastic_cloud_sso_default_url": {"key": "elasticCloudSsoDefaultUrl", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.email_address = None @@ -222,6 +232,8 @@ class ElasticMonitorResource(_serialization.Model): :vartype properties: ~azure.mgmt.elastic.models.MonitorProperties :ivar identity: Identity properties of the monitor resource. :vartype identity: ~azure.mgmt.elastic.models.IdentityProperties + :ivar generate_api_key: Flag to determine if User API Key has to be generated and shared. + :vartype generate_api_key: bool :ivar tags: The tags of the monitor resource. :vartype tags: dict[str, str] :ivar location: The location of the monitor resource. Required. @@ -234,6 +246,7 @@ class ElasticMonitorResource(_serialization.Model): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "generate_api_key": {"readonly": True}, "location": {"required": True}, "system_data": {"readonly": True}, } @@ -245,6 +258,7 @@ class ElasticMonitorResource(_serialization.Model): "sku": {"key": "sku", "type": "ResourceSku"}, "properties": {"key": "properties", "type": "MonitorProperties"}, "identity": {"key": "identity", "type": "IdentityProperties"}, + "generate_api_key": {"key": "generateApiKey", "type": "bool"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, @@ -258,8 +272,8 @@ def __init__( properties: Optional["_models.MonitorProperties"] = None, identity: Optional["_models.IdentityProperties"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: SKU of the monitor resource. :paramtype sku: ~azure.mgmt.elastic.models.ResourceSku @@ -279,6 +293,7 @@ def __init__( self.sku = sku self.properties = properties self.identity = identity + self.generate_api_key = None self.tags = tags self.location = location self.system_data = None @@ -303,8 +318,8 @@ def __init__( *, value: Optional[List["_models.ElasticMonitorResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] @@ -327,7 +342,7 @@ class ElasticMonitorResourceUpdateParameters(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: elastic monitor resource tags. :paramtype tags: dict[str, str] @@ -347,7 +362,7 @@ class ElasticMonitorUpgrade(_serialization.Model): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, version: Optional[str] = None, **kwargs): + def __init__(self, *, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword version: Version to which the elastic monitor should be upgraded to. :paramtype version: str @@ -375,8 +390,8 @@ def __init__( *, elastic_cloud_user: Optional["_models.ElasticCloudUser"] = None, elastic_cloud_deployment: Optional["_models.ElasticCloudDeployment"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword elastic_cloud_user: Details of the user's elastic account. :paramtype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser @@ -427,8 +442,8 @@ def __init__( type: Optional[Union[str, "_models.Type"]] = None, include_by_default: Optional[bool] = None, rules: Optional[List["_models.ElasticTrafficFilterRule"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Id of the elastic filter. :paramtype id: str @@ -466,7 +481,7 @@ class ElasticTrafficFilterResponse(_serialization.Model): "rulesets": {"key": "rulesets", "type": "[ElasticTrafficFilter]"}, } - def __init__(self, *, rulesets: Optional[List["_models.ElasticTrafficFilter"]] = None, **kwargs): + def __init__(self, *, rulesets: Optional[List["_models.ElasticTrafficFilter"]] = None, **kwargs: Any) -> None: """ :keyword rulesets: List of elastic traffic filters in the account. :paramtype rulesets: list[~azure.mgmt.elastic.models.ElasticTrafficFilter] @@ -506,8 +521,8 @@ def __init__( azure_endpoint_guid: Optional[str] = None, azure_endpoint_name: Optional[str] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source: IP of the elastic filter rule. :paramtype source: str @@ -555,8 +570,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.ErrorResponseBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Error code. :paramtype code: str @@ -591,7 +606,7 @@ class ExternalUserCreationResponse(_serialization.Model): "created": {"key": "created", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.created = None @@ -628,8 +643,8 @@ def __init__( password: Optional[str] = None, email_id: Optional[str] = None, roles: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: Username of the user to be created or updated. :paramtype user_name: str @@ -651,7 +666,8 @@ def __init__( class FilteringTag(_serialization.Model): - """The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. + """The definition of a filtering tag. Filtering tags are used for capturing resources and + include/exclude them from being monitored. :ivar name: The name (also known as the key) of the tag. :vartype name: str @@ -673,8 +689,8 @@ def __init__( name: Optional[str] = None, value: Optional[str] = None, action: Optional[Union[str, "_models.TagAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name (also known as the key) of the tag. :paramtype name: str @@ -713,7 +729,7 @@ class IdentityProperties(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.ManagedIdentityTypes"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.ManagedIdentityTypes"]] = None, **kwargs: Any) -> None: """ :keyword type: Managed identity type. "SystemAssigned" :paramtype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes @@ -756,8 +772,8 @@ def __init__( send_subscription_logs: Optional[bool] = None, send_activity_logs: Optional[bool] = None, filtering_tags: Optional[List["_models.FilteringTag"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. :paramtype send_aad_logs: bool @@ -780,6 +796,70 @@ def __init__( self.filtering_tags = filtering_tags +class MarketplaceSaaSInfo(_serialization.Model): + """Marketplace SAAS Info of the resource. + + :ivar marketplace_subscription: Marketplace Subscription Id. + :vartype marketplace_subscription: + ~azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription + :ivar marketplace_name: Subscription Details: Marketplace SAAS Name. + :vartype marketplace_name: str + :ivar marketplace_resource_id: Subscription Details: Marketplace Resource URI. + :vartype marketplace_resource_id: str + """ + + _attribute_map = { + "marketplace_subscription": { + "key": "marketplaceSubscription", + "type": "MarketplaceSaaSInfoMarketplaceSubscription", + }, + "marketplace_name": {"key": "marketplaceName", "type": "str"}, + "marketplace_resource_id": {"key": "marketplaceResourceId", "type": "str"}, + } + + def __init__( + self, + *, + marketplace_subscription: Optional["_models.MarketplaceSaaSInfoMarketplaceSubscription"] = None, + marketplace_name: Optional[str] = None, + marketplace_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword marketplace_subscription: Marketplace Subscription Id. + :paramtype marketplace_subscription: + ~azure.mgmt.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription + :keyword marketplace_name: Subscription Details: Marketplace SAAS Name. + :paramtype marketplace_name: str + :keyword marketplace_resource_id: Subscription Details: Marketplace Resource URI. + :paramtype marketplace_resource_id: str + """ + super().__init__(**kwargs) + self.marketplace_subscription = marketplace_subscription + self.marketplace_name = marketplace_name + self.marketplace_resource_id = marketplace_resource_id + + +class MarketplaceSaaSInfoMarketplaceSubscription(_serialization.Model): + """Marketplace Subscription Id. + + :ivar id: Marketplace Subscription Id. This is a GUID-formatted string. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Marketplace Subscription Id. This is a GUID-formatted string. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + class MonitoredResource(_serialization.Model): """The properties of a resource currently being monitored by the Elastic monitor resource. @@ -805,8 +885,8 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin sending_logs: Optional[Union[str, "_models.SendingLogs"]] = None, reason_for_logs_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ARM id of the resource. :paramtype id: str @@ -838,8 +918,12 @@ class MonitoredResourceListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.MonitoredResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.MonitoredResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.elastic.models.MonitoredResource] @@ -883,7 +967,7 @@ class MonitoringTagRules(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: Optional["_models.MonitoringTagRulesProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.MonitoringTagRulesProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Properties of the monitoring tag rules. :paramtype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties @@ -911,8 +995,12 @@ class MonitoringTagRulesListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.MonitoringTagRules"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.MonitoringTagRules"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.elastic.models.MonitoringTagRules] @@ -945,8 +1033,8 @@ def __init__( *, provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, log_rules: Optional["_models.LogRules"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: Provisioning state of the monitoring tag rules. Known values are: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", @@ -1007,8 +1095,8 @@ def __init__( elastic_properties: Optional["_models.ElasticProperties"] = None, user_info: Optional["_models.UserInfo"] = None, version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provisioning_state: Provisioning state of the monitor resource. Known values are: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", @@ -1061,8 +1149,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider, i.e., Microsoft.Elastic. :paramtype provider: str @@ -1095,8 +1183,8 @@ class OperationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.OperationResult"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.OperationResult"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the Microsoft.Elastic provider. :paramtype value: list[~azure.mgmt.elastic.models.OperationResult] @@ -1135,8 +1223,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. :paramtype name: str @@ -1171,7 +1259,7 @@ class ResourceProviderDefaultErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorResponseBody"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.error = None @@ -1194,7 +1282,7 @@ class ResourceSku(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: Name of the SKU. Required. :paramtype name: str @@ -1240,8 +1328,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1282,8 +1370,8 @@ class UpgradableVersionsList(_serialization.Model): } def __init__( - self, *, current_version: Optional[str] = None, upgradable_versions: Optional[List[str]] = None, **kwargs - ): + self, *, current_version: Optional[str] = None, upgradable_versions: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword current_version: Current version of the elastic monitor. :paramtype current_version: str @@ -1295,6 +1383,49 @@ def __init__( self.upgradable_versions = upgradable_versions +class UserApiKeyResponse(_serialization.Model): + """The User Api Key created for the Organization associated with the User Email Id that was passed + in the request. + + :ivar api_key: The User Api Key Generated based on ReturnApiKey flag. This is applicable for + non-Portal clients only. + :vartype api_key: str + """ + + _attribute_map = { + "api_key": {"key": "apiKey", "type": "str"}, + } + + def __init__(self, *, api_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword api_key: The User Api Key Generated based on ReturnApiKey flag. This is applicable for + non-Portal clients only. + :paramtype api_key: str + """ + super().__init__(**kwargs) + self.api_key = api_key + + +class UserEmailId(_serialization.Model): + """Email Id of the User Organization, of which the API Key must be returned. + + :ivar email_id: The User email Id. + :vartype email_id: str + """ + + _attribute_map = { + "email_id": {"key": "emailId", "type": "str"}, + } + + def __init__(self, *, email_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword email_id: The User email Id. + :paramtype email_id: str + """ + super().__init__(**kwargs) + self.email_id = email_id + + class UserInfo(_serialization.Model): """User Information to be passed to partners. @@ -1313,7 +1444,7 @@ class UserInfo(_serialization.Model): _validation = { "first_name": {"max_length": 50}, "last_name": {"max_length": 50}, - "company_name": {"max_length": 50}, + "company_name": {"max_length": 64}, "email_address": { "pattern": r'^([^<>()\[\]\.,;:\s@"]+(\.[^<>()\[\]\.,;:\s@"]+)*)@(([a-zA-Z-_0-9]+\.)+[a-zA-Z]{2,})$' }, @@ -1335,8 +1466,8 @@ def __init__( company_name: Optional[str] = None, email_address: Optional[str] = None, company_info: Optional["_models.CompanyInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword first_name: First name of the user. :paramtype first_name: str @@ -1377,8 +1508,8 @@ def __init__( *, vm_resource_id: Optional[str] = None, operation_name: Optional[Union[str, "_models.OperationName"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword vm_resource_id: ARM id of the VM resource. :paramtype vm_resource_id: str @@ -1406,8 +1537,8 @@ class VMHostListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.VMResources"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.VMResources"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.elastic.models.VMResources] @@ -1433,7 +1564,7 @@ class VMIngestionDetailsResponse(_serialization.Model): "ingestion_key": {"key": "ingestionKey", "type": "str"}, } - def __init__(self, *, cloud_id: Optional[str] = None, ingestion_key: Optional[str] = None, **kwargs): + def __init__(self, *, cloud_id: Optional[str] = None, ingestion_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cloud_id: The cloudId of given Elastic monitor resource. :paramtype cloud_id: str @@ -1456,7 +1587,7 @@ class VMResources(_serialization.Model): "vm_resource_id": {"key": "vmResourceId", "type": "str"}, } - def __init__(self, *, vm_resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, vm_resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword vm_resource_id: The ARM id of the VM resource. :paramtype vm_resource_id: str diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py index 58ff8e477e4d..47af29eeb877 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/__init__.py @@ -25,9 +25,10 @@ from ._detach_and_delete_traffic_filter_operations import DetachAndDeleteTrafficFilterOperations from ._detach_traffic_filter_operations import DetachTrafficFilterOperations from ._traffic_filters_operations import TrafficFiltersOperations +from ._organizations_operations import OrganizationsOperations 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__ = [ @@ -50,6 +51,7 @@ "DetachAndDeleteTrafficFilterOperations", "DetachTrafficFilterOperations", "TrafficFiltersOperations", + "OrganizationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py index 5bc24295abcc..c4e06a0fc17f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_all_traffic_filters_operations.py @@ -43,9 +43,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -116,10 +116,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticTrafficFilterResponse] + ) + cls: ClsType[_models.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -131,9 +131,9 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -153,4 +153,6 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py index 17183eb13833..06bd142e99b1 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_associate_traffic_filter_operations.py @@ -52,9 +52,9 @@ def build_associate_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_associate_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -114,10 +114,10 @@ def _associate_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_associate_request( resource_group_name=resource_group_name, @@ -130,9 +130,9 @@ def _associate_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -148,7 +148,9 @@ def _associate_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _associate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter"} # type: ignore + _associate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + } @distributed_trace def begin_associate( @@ -180,13 +182,13 @@ def begin_associate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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._associate_initial( # type: ignore resource_group_name=resource_group_name, @@ -205,7 +207,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -217,6 +221,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_associate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter"} # type: ignore + begin_associate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py index 76ec20eaf892..c48e2e1e5cd2 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_ip_filter_operations.py @@ -53,9 +53,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_create_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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,10 +122,10 @@ def _create_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -139,15 +139,15 @@ def _create_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.ResourceProviderDefaultErrorResponse, pipeline_response @@ -157,7 +157,9 @@ def _create_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + } @distributed_trace def begin_create( @@ -196,13 +198,13 @@ def begin_create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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._create_initial( # type: ignore resource_group_name=resource_group_name, @@ -222,7 +224,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -234,6 +238,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_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py index d1fe2664a7d6..bf8ccc404862 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_create_and_associate_pl_filter_operations.py @@ -54,9 +54,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +70,7 @@ def build_create_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -126,10 +126,10 @@ def _create_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -144,15 +144,15 @@ def _create_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.ResourceProviderDefaultErrorResponse, pipeline_response @@ -162,7 +162,9 @@ def _create_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + } @distributed_trace def begin_create( @@ -204,13 +206,13 @@ def begin_create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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._create_initial( # type: ignore resource_group_name=resource_group_name, @@ -231,7 +233,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -243,6 +247,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_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py index 5f43dcfe515a..e7112fe685bb 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py @@ -43,9 +43,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -118,10 +118,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DeploymentInfoResponse] + ) + cls: ClsType[_models.DeploymentInfoResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -133,9 +133,9 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -155,4 +155,6 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py index eae5788a1897..3f4f30d1fcb0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_and_delete_traffic_filter_operations.py @@ -50,9 +50,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_delete_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -129,10 +129,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -145,9 +145,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -163,4 +163,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py index cb678342d802..85952fdefa70 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_detach_traffic_filter_operations.py @@ -52,9 +52,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_update_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -114,10 +114,10 @@ def _update_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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_request( resource_group_name=resource_group_name, @@ -130,9 +130,9 @@ def _update_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -148,7 +148,9 @@ def _update_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + } @distributed_trace def begin_update( @@ -180,13 +182,13 @@ def begin_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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._update_initial( # type: ignore resource_group_name=resource_group_name, @@ -205,7 +207,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -217,6 +221,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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py index f7a468229454..2b9b4e174912 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_external_user_operations.py @@ -45,10 +45,10 @@ def build_create_or_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_create_or_update_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -177,8 +177,8 @@ def create_or_update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic External User Creation Parameters. Is either a model type or a IO type. - Default value is None. + :param body: Elastic External User Creation Parameters. Is either a ExternalUserInfo type or a + IO type. Default value is None. :type body: ~azure.mgmt.elastic.models.ExternalUserInfo or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -199,11 +199,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalUserCreationResponse] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExternalUserCreationResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,9 +229,9 @@ def create_or_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -251,4 +251,6 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py index 86dae0b02b3b..f7e98fd52302 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_list_associated_traffic_filters_operations.py @@ -43,9 +43,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -116,10 +116,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticTrafficFilterResponse] + ) + cls: ClsType[_models.ElasticTrafficFilterResponse] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -131,9 +131,9 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -153,4 +153,6 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py index ab92f72c7fdc..9c28642b237c 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitor_operations.py @@ -47,10 +47,10 @@ def build_upgrade_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_upgrade_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -114,11 +114,11 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -144,9 +144,9 @@ def _upgrade_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -162,7 +162,9 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _upgrade_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade"} # type: ignore + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + } @overload def begin_upgrade( @@ -255,8 +257,8 @@ def begin_upgrade( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic Monitor Upgrade Parameters. Is either a model type or a IO type. Default - value is None. + :param body: Elastic Monitor Upgrade Parameters. Is either a ElasticMonitorUpgrade type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorUpgrade or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -276,14 +278,14 @@ def begin_upgrade( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._upgrade_initial( # type: ignore resource_group_name=resource_group_name, @@ -303,7 +305,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -315,6 +317,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_upgrade.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade"} # type: ignore + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py index 77528b53d9ae..61c8e5033ee8 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py @@ -45,9 +45,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -110,10 +110,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoredResourceListResponse] + ) + cls: ClsType[_models.MonitoredResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +136,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 +152,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,13 +160,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MonitoredResourceListResponse", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -182,4 +182,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py index f8e3f75d8bc1..4c66fe4737d3 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py @@ -47,9 +47,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,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") @@ -73,9 +73,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -103,9 +103,9 @@ def build_get_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_ "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -136,10 +136,10 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +153,7 @@ def build_create_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -172,10 +172,10 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +189,7 @@ def build_update_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -208,9 +208,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +224,7 @@ def build_delete_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -269,10 +269,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.ElasticMonitorResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResourceListResponse] + ) + cls: ClsType[_models.ElasticMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -293,7 +293,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 @@ -309,7 +309,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 @@ -317,13 +317,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -339,7 +339,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors"} @distributed_trace def list_by_resource_group( @@ -361,10 +361,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResourceListResponse] + ) + cls: ClsType[_models.ElasticMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +386,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 @@ -402,7 +402,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 @@ -410,13 +410,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ElasticMonitorResourceListResponse", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -432,7 +432,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.Elastic/monitors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + } @distributed_trace def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.ElasticMonitorResource: @@ -461,10 +463,10 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -476,9 +478,9 @@ def get(self, resource_group_name: str, monitor_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -498,7 +500,9 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } def _create_initial( self, @@ -518,11 +522,11 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -548,9 +552,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -570,11 +574,13 @@ def _create_initial( deserialized = self._deserialize("ElasticMonitorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @overload def begin_create( @@ -669,8 +675,8 @@ def begin_create( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic monitor resource model. Is either a model type or a IO type. Default value - is None. + :param body: Elastic monitor resource model. Is either a ElasticMonitorResource type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -691,16 +697,16 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = 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, monitor_name=monitor_name, body=body, @@ -720,9 +726,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: @@ -734,9 +740,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.Elastic/monitors/{monitorName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @overload def update( @@ -815,8 +823,8 @@ def update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Elastic resource model update parameters. Is either a model type or a IO type. - Default value is None. + :param body: Elastic resource model update parameters. Is either a + ElasticMonitorResourceUpdateParameters type or a IO type. Default value is None. :type body: ~azure.mgmt.elastic.models.ElasticMonitorResourceUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -837,11 +845,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ElasticMonitorResource] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ElasticMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -867,9 +875,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -889,7 +897,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, **kwargs: Any @@ -905,10 +915,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -920,9 +930,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -938,7 +948,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> LROPoller[None]: @@ -966,13 +978,13 @@ def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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, @@ -990,7 +1002,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1002,6 +1014,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.Elastic/monitors/{monitorName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py index 51364a8df34e..94843949628b 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py @@ -45,9 +45,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,10 +95,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -118,7 +118,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 @@ -134,7 +134,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 @@ -142,13 +142,13 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -164,4 +164,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Elastic/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Elastic/operations"} diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py new file mode 100644 index 000000000000..daee017e89bb --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_organizations_operations.py @@ -0,0 +1,242 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_api_key_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/getOrganizationApiKey", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class OrganizationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.elastic.MicrosoftElastic`'s + :attr:`organizations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get_api_key( + self, + resource_group_name: str, + body: Optional[_models.UserEmailId] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_api_key( + self, + resource_group_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_api_key( + self, resource_group_name: str, body: Optional[Union[_models.UserEmailId, IO]] = None, **kwargs: Any + ) -> _models.UserApiKeyResponse: + """Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + Fetch User API Key from internal database, if it was generated and stored while creating the + Elasticsearch Organization. + + :param resource_group_name: The name of the resource group to which the Elastic resource + belongs. Required. + :type resource_group_name: str + :param body: Email Id parameter of the User Organization, of which the API Key must be + returned. Is either a UserEmailId type or a IO type. Default value is None. + :type body: ~azure.mgmt.elastic.models.UserEmailId or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserApiKeyResponse or the result of cls(response) + :rtype: ~azure.mgmt.elastic.models.UserApiKeyResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-02-01-preview"] = 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.UserApiKeyResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "UserEmailId") + else: + _json = None + + request = build_get_api_key_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.get_api_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UserApiKeyResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_api_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/getOrganizationApiKey" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py index 3fbe063cbe3e..332d3dd9932a 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py @@ -47,9 +47,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +63,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -80,10 +80,10 @@ def build_create_or_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,7 @@ def build_create_or_update_request( "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "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") @@ -117,9 +117,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +134,7 @@ def build_get_request( "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "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,9 +151,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,7 @@ def build_delete_request( "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, "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") @@ -219,10 +219,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRulesListResponse] + ) + cls: ClsType[_models.MonitoringTagRulesListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -245,7 +245,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 @@ -261,7 +261,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 @@ -269,13 +269,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MonitoringTagRulesListResponse", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -291,7 +291,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules" + } @overload def create_or_update( @@ -379,8 +381,8 @@ def create_or_update( :type monitor_name: str :param rule_set_name: Tag Rule Set resource name. Required. :type rule_set_name: str - :param body: request body of MonitoringTagRules. Is either a model type or a IO type. Default - value is None. + :param body: request body of MonitoringTagRules. Is either a MonitoringTagRules type or a IO + type. Default value is None. :type body: ~azure.mgmt.elastic.models.MonitoringTagRules or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -401,11 +403,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -432,9 +434,9 @@ def create_or_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -454,7 +456,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace def get( @@ -487,10 +491,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + ) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -503,9 +507,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -525,7 +529,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, rule_set_name: str, **kwargs: Any @@ -541,10 +547,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -557,9 +563,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -575,7 +581,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace def begin_delete( @@ -607,13 +615,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + 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, @@ -632,7 +640,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -644,6 +652,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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py index 2e8f1de0e817..a8c788dd12ca 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_traffic_filters_operations.py @@ -50,9 +50,9 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_delete_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -129,10 +129,10 @@ 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: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -145,9 +145,9 @@ 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -163,4 +163,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py index 430ef49e1daa..e809df8d6ce7 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_upgradable_versions_operations.py @@ -45,9 +45,9 @@ def build_details_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_details_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -118,10 +118,10 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UpgradableVersionsList] + ) + cls: ClsType[_models.UpgradableVersionsList] = kwargs.pop("cls", None) request = build_details_request( resource_group_name=resource_group_name, @@ -133,9 +133,9 @@ def details(self, resource_group_name: str, monitor_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -155,4 +155,6 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> return deserialized - details.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions"} # type: ignore + details.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py index a7ca16d470e3..032a7a6f2107 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py @@ -45,10 +45,10 @@ 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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_update_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -171,7 +171,8 @@ def update( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: VM resource Id. Is either a model type or a IO type. Default value is None. + :param body: VM resource Id. Is either a VMCollectionUpdate type or a IO type. Default value is + None. :type body: ~azure.mgmt.elastic.models.VMCollectionUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -192,11 +193,11 @@ def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -222,9 +223,9 @@ def update( # 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -240,4 +241,6 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py index 6eb3f796ef1a..521330af8854 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py @@ -45,9 +45,9 @@ def build_list_request(resource_group_name: str, monitor_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -110,10 +110,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VMHostListResponse] + ) + cls: ClsType[_models.VMHostListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +136,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 +152,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,13 +160,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("VMHostListResponse", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -182,4 +182,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost" + } diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py index c9d64d20c13d..b9ea79e64d75 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py @@ -45,9 +45,9 @@ def build_details_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-07-01-preview") - ) # type: Literal["2022-07-01-preview"] + api_version: Literal["2023-02-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-02-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_details_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "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") @@ -118,10 +118,10 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2023-02-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-07-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.VMIngestionDetailsResponse] + ) + cls: ClsType[_models.VMIngestionDetailsResponse] = kwargs.pop("cls", None) request = build_details_request( resource_group_name=resource_group_name, @@ -133,9 +133,9 @@ def details(self, resource_group_name: str, monitor_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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -155,4 +155,6 @@ def details(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> return deserialized - details.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails"} # type: ignore + details.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails" + } diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py index 264ed20f612c..a42374ba3806 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/all_traffic_filters_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/AllTrafficFilters_list.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AllTrafficFilters_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_associate.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py similarity index 92% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_associate.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py index 14d12a97c955..4ebfacddd958 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_associate.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associate_traffic_filter_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python associate_traffic_filter_associate.py + python associate_traffic_filter_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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/AssociateTrafficFilter_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociateTrafficFilter_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/list_associated_traffic_filters_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py similarity index 92% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/list_associated_traffic_filters_list.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py index bf286f8c0b6d..7fa71659b4f9 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/list_associated_traffic_filters_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/associated_filters_for_deployment_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python list_associated_traffic_filters_list.py + python associated_filters_for_deployment_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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/AssociatedFiltersForDeployment_list.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociatedFiltersForDeployment_list.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py index ada7477aa17c..f9f5471d191c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/deployment_info_list.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/DeploymentInfo_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DeploymentInfo_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py index 0d06ce3ee91a..37c3be96b736 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_and_delete_traffic_filter_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/DetachAndDeleteTrafficFilter_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachAndDeleteTrafficFilter_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filter_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py similarity index 93% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filter_update.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py index 7d606f23b41c..d1bc562e0155 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filter_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/detach_traffic_filters_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python detach_traffic_filter_update.py + python detach_traffic_filters_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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/DetachTrafficFilters_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachTrafficFilters_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py similarity index 93% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_create_or_update.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py index a7a7f0e46aef..cb2d81d0f7a2 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_create_or_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/external_user_info.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python external_user_create_or_update.py + python external_user_info.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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/ExternalUserInfo.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/ExternalUserInfo.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_ip_filter_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py similarity index 92% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_ip_filter_create.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py index 4a5d8d6db741..7c9f06f5823c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_ip_filter_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/ip_traffic_filter_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python create_and_associate_ip_filter_create.py + python ip_traffic_filter_create.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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/IPTrafficFilter_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/IPTrafficFilter_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py index 425675cbda5e..03933d91bf37 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitor_upgrade.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitor_Upgrade.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitor_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py index 3d4d137d2cf1..34c42022dd53 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitored_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/MonitoredResources_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/MonitoredResources_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py index 1845c179feb7..97bec945a017 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_create.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py index 4515a1e74566..e618dbfeb7b3 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py index c3fcc98252f9..2374996c0997 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_Get.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py index 232348353cce..780a08c79273 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py index 6b332a7ff21d..4263efcf6b3c 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py index 06127f79010a..45f443cf06b8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/monitors_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Monitors_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py index 0bc0687671ee..789d816651c8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py new file mode 100644 index 000000000000..6331ba97452b --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/organizations_get_api_key.py @@ -0,0 +1,40 @@ +# 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.elastic import MicrosoftElastic + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-elastic +# USAGE + python organizations_get_api_key.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 = MicrosoftElastic( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.organizations.get_api_key( + resource_group_name="myResourceGroup", + ) + print(response) + + +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Organizations_GetApiKey.json +if __name__ == "__main__": + main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_pl_filter_create.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py similarity index 92% rename from sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_pl_filter_create.py rename to sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py index 5a8cf22fd395..6fc1a55f2f98 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/create_and_associate_pl_filter_create.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/private_link_traffic_filters_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-elastic # USAGE - python create_and_associate_pl_filter_create.py + python private_link_traffic_filters_create.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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/PrivateLinkTrafficFilters_Create.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/PrivateLinkTrafficFilters_Create.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py index 9c7686d235f7..f16175babc31 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py index 68b2c5e1fa1c..07be4c529575 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/TagRules_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py index 21e97e718374..ac3e4b327080 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/TagRules_Get.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py index fcd3416a33a0..4635af09ee15 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/tag_rules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/TagRules_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py index 0cbc31588b46..12d2890ec1b8 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/traffic_filters_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/TrafficFilters_Delete.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TrafficFilters_Delete.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py index 8d1db0786b32..9760ac3fc9ad 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/upgradable_versions_details.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/UpgradableVersions_Details.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/UpgradableVersions_Details.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py index 95d89775a71c..46d2923474a9 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_collection_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/VMCollection_Update.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMCollection_Update.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py index c9bc3f14f5e6..377cd922c9c5 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_host_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/VMHost_List.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMHost_List.json if __name__ == "__main__": main() diff --git a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py index 7a183de94733..88b44f9d902e 100644 --- a/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py +++ b/sdk/elastic/azure-mgmt-elastic/generated_samples/vm_ingestion_details.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2022-07-01-preview/examples/VMIngestion_Details.json +# x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMIngestion_Details.json if __name__ == "__main__": main()