From 1da3df46a83d90c216393c5147f9e6f4b322bd8a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 25 Sep 2023 06:02:01 +0000 Subject: [PATCH] CodeGen from PR 24495 in Azure/azure-rest-api-specs Merge e04eb45a0d9026fe876b1e070768d82cb3223571 into 24c9b5a8982cb081662b27ef8ab93da3389b0160 --- sdk/datadog/azure-mgmt-datadog/_meta.json | 10 +- .../azure/mgmt/datadog/__init__.py | 2 +- .../azure/mgmt/datadog/_configuration.py | 15 +- .../mgmt/datadog/_microsoft_datadog_client.py | 32 +- .../azure/mgmt/datadog/_serialization.py | 206 ++-- .../azure/mgmt/datadog/_vendor.py | 11 - .../azure/mgmt/datadog/_version.py | 2 +- .../azure/mgmt/datadog/aio/__init__.py | 2 +- .../azure/mgmt/datadog/aio/_configuration.py | 10 +- .../datadog/aio/_microsoft_datadog_client.py | 25 +- .../mgmt/datadog/aio/operations/__init__.py | 6 +- .../_creation_supported_operations.py | 207 ++++ .../_marketplace_agreements_operations.py | 48 +- .../_monitored_subscriptions_operations.py | 848 ++++++++++++++ .../aio/operations/_monitors_operations.py | 340 +++--- .../datadog/aio/operations/_operations.py | 28 +- ...ingle_sign_on_configurations_operations.py | 95 +- .../aio/operations/_tag_rules_operations.py | 67 +- .../azure/mgmt/datadog/models/__init__.py | 20 +- .../models/_microsoft_datadog_client_enums.py | 23 +- .../azure/mgmt/datadog/models/_models_py3.py | 445 ++++++-- .../azure/mgmt/datadog/operations/__init__.py | 6 +- .../_creation_supported_operations.py | 261 +++++ .../_marketplace_agreements_operations.py | 60 +- .../_monitored_subscriptions_operations.py | 1017 +++++++++++++++++ .../operations/_monitors_operations.py | 400 +++---- .../mgmt/datadog/operations/_operations.py | 30 +- ...ingle_sign_on_configurations_operations.py | 111 +- .../operations/_tag_rules_operations.py | 83 +- ...ult_key.py => api_keys_get_default_key.py} | 4 +- ...tors_list_api_keys.py => api_keys_list.py} | 4 +- ...ult_key.py => api_keys_set_default_key.py} | 7 +- .../creation_supported_get.py | 40 + .../creation_supported_list.py | 41 + .../{monitors_list_hosts.py => hosts_list.py} | 4 +- ..._resources.py => linked_resources_list.py} | 4 +- ...te.py => marketplace_agreements_create.py} | 4 +- .../marketplace_agreements_list.py | 2 +- ...sources.py => monitored_resources_list.py} | 4 +- ...monitored_subscriptions_createor_update.py | 42 + .../monitored_subscriptions_delete.py | 41 + .../monitored_subscriptions_get.py | 42 + .../monitored_subscriptions_list.py | 42 + .../monitored_subscriptions_update.py | 42 + .../generated_samples/monitors_create.py | 2 +- .../generated_samples/monitors_delete.py | 5 +- .../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 +- ...rd_link.py => refresh_set_password_get.py} | 4 +- ...sign_on_configurations_create_or_update.py | 2 +- .../single_sign_on_configurations_get.py | 2 +- .../single_sign_on_configurations_list.py | 2 +- .../tag_rules_create_or_update.py | 2 +- .../generated_samples/tag_rules_get.py | 2 +- .../generated_samples/tag_rules_list.py | 2 +- 58 files changed, 3866 insertions(+), 900 deletions(-) create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_creation_supported_operations.py create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_subscriptions_operations.py create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_creation_supported_operations.py create mode 100644 sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_subscriptions_operations.py rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_get_default_key.py => api_keys_get_default_key.py} (93%) rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_list_api_keys.py => api_keys_list.py} (93%) rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_set_default_key.py => api_keys_set_default_key.py} (89%) create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_get.py create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_list.py rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_list_hosts.py => hosts_list.py} (94%) rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_list_linked_resources.py => linked_resources_list.py} (93%) rename sdk/datadog/azure-mgmt-datadog/generated_samples/{marketplace_agreements_create_or_update.py => marketplace_agreements_create.py} (92%) rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_list_monitored_resources.py => monitored_resources_list.py} (93%) create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_createor_update.py create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_delete.py create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_get.py create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_list.py create mode 100644 sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_update.py rename sdk/datadog/azure-mgmt-datadog/generated_samples/{monitors_refresh_set_password_link.py => refresh_set_password_get.py} (92%) diff --git a/sdk/datadog/azure-mgmt-datadog/_meta.json b/sdk/datadog/azure-mgmt-datadog/_meta.json index 43d5edb9cc8d..d90ffd52a9fe 100644 --- a/sdk/datadog/azure-mgmt-datadog/_meta.json +++ b/sdk/datadog/azure-mgmt-datadog/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0c21115ccacbbad11c4aa13a711e4990ebf07752", + "commit": "335ec5786f06b433186a178e07fde2d2738bb888", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.1", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/datadog/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/datadog/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/datadog/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__init__.py index fd5e3d8e648c..63d0fedd527b 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py index ff713bd00fcd..474c530c74bf 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class MicrosoftDatadogClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-datadog/{}".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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py index 1c1b3da8c3be..f6cd2fa6e71f 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py @@ -12,11 +12,13 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import MicrosoftDatadogClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + CreationSupportedOperations, MarketplaceAgreementsOperations, + MonitoredSubscriptionsOperations, MonitorsOperations, Operations, SingleSignOnConfigurationsOperations, @@ -28,11 +30,13 @@ from azure.core.credentials import TokenCredential -class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword +class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """MicrosoftDatadogClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations :vartype marketplace_agreements: azure.mgmt.datadog.operations.MarketplaceAgreementsOperations + :ivar creation_supported: CreationSupportedOperations operations + :vartype creation_supported: azure.mgmt.datadog.operations.CreationSupportedOperations :ivar monitors: MonitorsOperations operations :vartype monitors: azure.mgmt.datadog.operations.MonitorsOperations :ivar operations: Operations operations @@ -42,13 +46,16 @@ class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyw :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations :vartype single_sign_on_configurations: azure.mgmt.datadog.operations.SingleSignOnConfigurationsOperations + :ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations + :vartype monitored_subscriptions: + azure.mgmt.datadog.operations.MonitoredSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -65,21 +72,27 @@ def __init__( self._config = MicrosoftDatadogClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.creation_supported = CreationSupportedOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.monitored_subscriptions = MonitoredSubscriptionsOperations( + 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. @@ -103,15 +116,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: () -> MicrosoftDatadogClient + def __enter__(self) -> "MicrosoftDatadogClient": 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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_serialization.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_serialization.py index 7c1dedb5133d..4bae2292227b 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_serialization.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,26 +645,26 @@ 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 + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -659,8 +683,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 +699,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: @@ -718,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -726,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -780,6 +804,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 +869,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 @@ -866,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -878,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -925,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1001,10 +1036,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 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1371,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 +1391,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 +1452,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 +1480,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 +1510,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 +1525,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 +1535,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 +1579,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 +1601,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 +1783,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 +1834,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 +1846,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 +1862,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 +1877,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 +1907,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 +1922,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 +1937,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 +1960,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 +1996,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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py index b82e03a368ff..e5754a47ce68 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/__init__.py index c1ac353b0182..5fef36364b71 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py index 8f5a2a189161..7be4afb3bd40 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class MicrosoftDatadogClientConfiguration(Configuration): # pylint: disable=too :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", "2023-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py index 9809fbd4c49b..9f4e0714aff8 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_microsoft_datadog_client.py @@ -12,11 +12,13 @@ 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 MicrosoftDatadogClientConfiguration from .operations import ( + CreationSupportedOperations, MarketplaceAgreementsOperations, + MonitoredSubscriptionsOperations, MonitorsOperations, Operations, SingleSignOnConfigurationsOperations, @@ -28,12 +30,14 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword +class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """MicrosoftDatadogClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations :vartype marketplace_agreements: azure.mgmt.datadog.aio.operations.MarketplaceAgreementsOperations + :ivar creation_supported: CreationSupportedOperations operations + :vartype creation_supported: azure.mgmt.datadog.aio.operations.CreationSupportedOperations :ivar monitors: MonitorsOperations operations :vartype monitors: azure.mgmt.datadog.aio.operations.MonitorsOperations :ivar operations: Operations operations @@ -43,13 +47,16 @@ class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyw :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations :vartype single_sign_on_configurations: azure.mgmt.datadog.aio.operations.SingleSignOnConfigurationsOperations + :ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations + :vartype monitored_subscriptions: + azure.mgmt.datadog.aio.operations.MonitoredSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -66,21 +73,27 @@ def __init__( self._config = MicrosoftDatadogClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.marketplace_agreements = MarketplaceAgreementsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.creation_supported = CreationSupportedOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.single_sign_on_configurations = SingleSignOnConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.monitored_subscriptions = MonitoredSubscriptionsOperations( + 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. @@ -111,5 +124,5 @@ async def __aenter__(self) -> "MicrosoftDatadogClient": 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/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py index e8bd1df388c8..8370b25c3643 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/__init__.py @@ -7,21 +7,25 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations +from ._creation_supported_operations import CreationSupportedOperations from ._monitors_operations import MonitorsOperations from ._operations import Operations from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations +from ._monitored_subscriptions_operations import MonitoredSubscriptionsOperations 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__ = [ "MarketplaceAgreementsOperations", + "CreationSupportedOperations", "MonitorsOperations", "Operations", "TagRulesOperations", "SingleSignOnConfigurationsOperations", + "MonitoredSubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_creation_supported_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_creation_supported_operations.py new file mode 100644 index 000000000000..dbbf75f8b416 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_creation_supported_operations.py @@ -0,0 +1,207 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.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._creation_supported_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CreationSupportedOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datadog.aio.MicrosoftDatadogClient`'s + :attr:`creation_supported` 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") + + @distributed_trace + def list( + self, datadog_organization_id: str, **kwargs: Any + ) -> AsyncIterable["_models.CreateResourceSupportedResponse"]: + """Informs if the current subscription is being already monitored for selected Datadog + organization. + + Informs if the current subscription is being already monitored for selected Datadog + organization. + + :param datadog_organization_id: Datadog Organization Id. Required. + :type datadog_organization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CreateResourceSupportedResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datadog.models.CreateResourceSupportedResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CreateResourceSupportedResponseList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + datadog_organization_id=datadog_organization_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CreateResourceSupportedResponseList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses"} + + @distributed_trace_async + async def get(self, datadog_organization_id: str, **kwargs: Any) -> _models.CreateResourceSupportedResponse: + """Informs if the current subscription is being already monitored for selected Datadog + organization. + + Informs if the current subscription is being already monitored for selected Datadog + organization. + + :param datadog_organization_id: Datadog Organization Id. Required. + :type datadog_organization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CreateResourceSupportedResponse or the result of cls(response) + :rtype: ~azure.mgmt.datadog.models.CreateResourceSupportedResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CreateResourceSupportedResponse] = kwargs.pop("cls", None) + + request = build_get_request( + subscription_id=self._config.subscription_id, + datadog_organization_id=datadog_organization_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CreateResourceSupportedResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses/default"} diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py index bd831ff1da66..f5e01a5817c8 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_marketplace_agreements_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -31,10 +31,6 @@ from ..._vendor import _convert_request from ...operations._marketplace_agreements_operations import build_create_or_update_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,10 +70,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DatadogAgreementResource _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogAgreementResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogAgreementResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +92,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 @@ -114,7 +108,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 @@ -122,14 +116,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,7 +137,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements"} @overload async def create_or_update( @@ -194,7 +189,7 @@ async def create_or_update( Create Datadog marketplace agreement in the subscription. - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogAgreementResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogAgreementResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -215,16 +210,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogAgreementResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogAgreementResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -243,10 +236,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -263,4 +257,6 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_subscriptions_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_subscriptions_operations.py new file mode 100644 index 000000000000..89a14f086ceb --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_subscriptions_operations.py @@ -0,0 +1,848 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitored_subscriptions_operations import ( + build_createor_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MonitoredSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datadog.aio.MicrosoftDatadogClient`'s + :attr:`monitored_subscriptions` 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") + + @distributed_trace + def list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MonitoredSubscriptionProperties"]: + """List the subscriptions currently being monitored by the Datadog monitor resource. + + List the subscriptions currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredSubscriptionProperties or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredSubscriptionPropertiesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionPropertiesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> _models.MonitoredSubscriptionProperties: + """List the subscriptions currently being monitored by the Datadog monitor resource. + + List the subscriptions currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoredSubscriptionProperties or the result of cls(response) + :rtype: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + async def _createor_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> Optional[_models.MonitoredSubscriptionProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MonitoredSubscriptionProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "MonitoredSubscriptionProperties") + else: + _json = None + + request = build_createor_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._createor_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _createor_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO type. Default value is + None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._createor_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_createor_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + async def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> Optional[_models.MonitoredSubscriptionProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MonitoredSubscriptionProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "MonitoredSubscriptionProperties") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO type. Default value is + None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoredSubscriptionProperties or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: Configuration name. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: 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, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py index 6a33da8db6c0..b253930c9131 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -47,10 +47,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +91,8 @@ def list_api_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogApiKeyListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogApiKeyListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -121,7 +115,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 @@ -137,7 +131,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 @@ -145,14 +139,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogApiKeyListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_api_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys"} # type: ignore + list_api_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys" + } @distributed_trace_async async def get_default_key( @@ -196,10 +193,8 @@ async def get_default_key( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogApiKey] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogApiKey] = kwargs.pop("cls", None) request = build_get_default_key_request( resource_group_name=resource_group_name, @@ -211,10 +206,11 @@ async def get_default_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -231,7 +227,9 @@ async def get_default_key( return deserialized - get_default_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey"} # type: ignore + get_default_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey" + } @overload async def set_default_key( # pylint: disable=inconsistent-return-statements @@ -310,7 +308,7 @@ async def set_default_key( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogApiKey type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogApiKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -331,16 +329,14 @@ async def set_default_key( # 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -361,10 +357,11 @@ async def set_default_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,7 +374,9 @@ async def set_default_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - set_default_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey"} # type: ignore + set_default_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey" + } @distributed_trace def list_hosts( @@ -400,10 +399,8 @@ def list_hosts( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogHostListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogHostListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -426,7 +423,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 @@ -442,7 +439,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 @@ -450,14 +447,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +468,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_hosts.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts"} # type: ignore + list_hosts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts" + } @distributed_trace def list_linked_resources( @@ -493,10 +493,8 @@ def list_linked_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkedResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkedResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -519,7 +517,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 @@ -535,7 +533,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 @@ -543,14 +541,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("LinkedResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,7 +562,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_linked_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources"} # type: ignore + list_linked_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources" + } @distributed_trace def list_monitored_resources( @@ -586,10 +587,8 @@ def list_monitored_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoredResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -612,7 +611,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 @@ -628,7 +627,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 @@ -636,14 +635,15 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,7 +656,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_monitored_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources"} # type: ignore + list_monitored_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources" + } @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DatadogMonitorResource"]: @@ -674,10 +676,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DatadogMonitorResource"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -698,7 +698,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 @@ -714,7 +714,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 @@ -722,14 +722,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,7 +743,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors"} @distributed_trace def list_by_resource_group( @@ -765,10 +766,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -790,7 +789,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 @@ -806,7 +805,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 @@ -814,14 +813,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,7 +834,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.Datadog/monitors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + } @distributed_trace_async async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DatadogMonitorResource: @@ -863,10 +865,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -878,10 +878,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,7 +899,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.Datadog/monitors/{monitorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } async def _create_initial( self, @@ -918,16 +921,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -948,10 +949,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -968,11 +970,13 @@ async def _create_initial( deserialized = self._deserialize("DatadogMonitorResource", 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.Datadog/monitors/{monitorName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @overload async def begin_create( @@ -1067,7 +1071,7 @@ async def begin_create( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogMonitorResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogMonitorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1088,16 +1092,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = 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, @@ -1117,10 +1119,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: @@ -1132,9 +1134,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.Datadog/monitors/{monitorName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } async def _update_initial( self, @@ -1154,16 +1158,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1184,10 +1186,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1204,11 +1207,13 @@ async def _update_initial( deserialized = self._deserialize("DatadogMonitorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @overload async def begin_update( @@ -1303,7 +1308,8 @@ async def begin_update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogMonitorResourceUpdateParameters type or a IO type. Default + value is None. :type body: ~azure.mgmt.datadog.models.DatadogMonitorResourceUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1324,16 +1330,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, @@ -1353,7 +1357,7 @@ def get_long_running_output(pipeline_response): return deserialized 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: @@ -1365,9 +1369,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, **kwargs: Any @@ -1383,10 +1389,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1398,10 +1402,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1414,7 +1419,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.Datadog/monitors/{monitorName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1442,13 +1449,11 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1466,7 +1471,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: @@ -1478,9 +1483,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @distributed_trace_async async def refresh_set_password_link( @@ -1511,10 +1518,8 @@ async def refresh_set_password_link( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSetPasswordLink] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSetPasswordLink] = kwargs.pop("cls", None) request = build_refresh_set_password_link_request( resource_group_name=resource_group_name, @@ -1526,10 +1531,11 @@ async def refresh_set_password_link( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1546,4 +1552,6 @@ async def refresh_set_password_link( return deserialized - refresh_set_password_link.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink"} # type: ignore + refresh_set_password_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_operations.py index b4dd24213a55..9a06c2037d3e 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,9 +54,9 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: - """List all operations provided by Microsoft.Datadog for the 2022-06-01 api version. + """List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - List all operations provided by Microsoft.Datadog for the 2022-06-01 api version. + List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) @@ -71,10 +66,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +87,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 +103,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,14 +111,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Datadog/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Datadog/operations"} diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py index 284961f384cb..b9c25fe0604b 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_single_sign_on_configurations_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,10 +37,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,10 +83,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSingleSignOnResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,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 @@ -129,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 @@ -137,14 +131,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DatadogSingleSignOnResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,7 +152,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations" + } async def _create_or_update_initial( self, @@ -178,16 +175,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogSingleSignOnResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -209,10 +204,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,11 +225,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("DatadogSingleSignOnResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } @overload async def begin_create_or_update( @@ -339,7 +337,7 @@ async def begin_create_or_update( :type monitor_name: str :param configuration_name: Configuration name. Required. :type configuration_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogSingleSignOnResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogSingleSignOnResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -361,16 +359,14 @@ async def begin_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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogSingleSignOnResource] = 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_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, @@ -391,10 +387,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: @@ -406,9 +402,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_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } @distributed_trace_async async def get( @@ -441,10 +439,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSingleSignOnResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -457,10 +453,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,4 +474,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py index 2a6dd2206f5b..253d800b3dea 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_tag_rules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -31,10 +31,6 @@ from ..._vendor import _convert_request from ...operations._tag_rules_operations import build_create_or_update_request, build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,10 +75,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRulesListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringTagRulesListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +99,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 @@ -121,7 +115,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 @@ -129,14 +123,15 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules" + } @overload async def create_or_update( @@ -237,7 +234,7 @@ async def create_or_update( :type monitor_name: str :param rule_set_name: Rule set name. Required. :type rule_set_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a MonitoringTagRules type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.MonitoringTagRules or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -258,16 +255,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -289,10 +284,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +305,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace_async async def get( @@ -342,10 +340,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -358,10 +354,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,4 +375,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py index ec0126853caf..0e0d4530f45a 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py @@ -6,6 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import CreateResourceSupportedProperties +from ._models_py3 import CreateResourceSupportedResponse +from ._models_py3 import CreateResourceSupportedResponseList from ._models_py3 import DatadogAgreementProperties from ._models_py3 import DatadogAgreementResource from ._models_py3 import DatadogAgreementResourceListResponse @@ -37,6 +40,9 @@ from ._models_py3 import MonitorUpdateProperties from ._models_py3 import MonitoredResource from ._models_py3 import MonitoredResourceListResponse +from ._models_py3 import MonitoredSubscription +from ._models_py3 import MonitoredSubscriptionProperties +from ._models_py3 import MonitoredSubscriptionPropertiesList from ._models_py3 import MonitoringTagRules from ._models_py3 import MonitoringTagRulesListResponse from ._models_py3 import MonitoringTagRulesProperties @@ -44,6 +50,7 @@ from ._models_py3 import OperationListResult from ._models_py3 import OperationResult from ._models_py3 import ResourceSku +from ._models_py3 import SubscriptionList from ._models_py3 import SystemData from ._models_py3 import UserInfo @@ -52,14 +59,19 @@ from ._microsoft_datadog_client_enums import ManagedIdentityTypes from ._microsoft_datadog_client_enums import MarketplaceSubscriptionStatus from ._microsoft_datadog_client_enums import MonitoringStatus +from ._microsoft_datadog_client_enums import Operation from ._microsoft_datadog_client_enums import ProvisioningState from ._microsoft_datadog_client_enums import SingleSignOnStates +from ._microsoft_datadog_client_enums import Status from ._microsoft_datadog_client_enums import TagAction 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__ = [ + "CreateResourceSupportedProperties", + "CreateResourceSupportedResponse", + "CreateResourceSupportedResponseList", "DatadogAgreementProperties", "DatadogAgreementResource", "DatadogAgreementResourceListResponse", @@ -91,6 +103,9 @@ "MonitorUpdateProperties", "MonitoredResource", "MonitoredResourceListResponse", + "MonitoredSubscription", + "MonitoredSubscriptionProperties", + "MonitoredSubscriptionPropertiesList", "MonitoringTagRules", "MonitoringTagRulesListResponse", "MonitoringTagRulesProperties", @@ -98,6 +113,7 @@ "OperationListResult", "OperationResult", "ResourceSku", + "SubscriptionList", "SystemData", "UserInfo", "CreatedByType", @@ -105,8 +121,10 @@ "ManagedIdentityTypes", "MarketplaceSubscriptionStatus", "MonitoringStatus", + "Operation", "ProvisioningState", "SingleSignOnStates", + "Status", "TagAction", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py index 5433be143262..36d8e855c615 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_microsoft_datadog_client_enums.py @@ -27,7 +27,9 @@ class LiftrResourceCategories(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ManagedIdentityTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Identity type.""" + """Specifies the identity type of the Datadog Monitor. At this time the only allowed value is + 'SystemAssigned'. + """ SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" @@ -51,6 +53,16 @@ class MonitoringStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class Operation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operation for the patch on the resource.""" + + ADD_BEGIN = "AddBegin" + ADD_COMPLETE = "AddComplete" + DELETE_BEGIN = "DeleteBegin" + DELETE_COMPLETE = "DeleteComplete" + ACTIVE = "Active" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ProvisioningState.""" @@ -74,6 +86,15 @@ class SingleSignOnStates(str, Enum, metaclass=CaseInsensitiveEnumMeta): EXISTING = "Existing" +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of monitoring.""" + + IN_PROGRESS = "InProgress" + ACTIVE = "Active" + FAILED = "Failed" + DELETING = "Deleting" + + class TagAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Valid actions for a filtering tag. Exclusion takes priority over inclusion.""" diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py index c85e6e9f29d0..ea12bbd8f963 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models_py3.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/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 @@ -17,6 +17,80 @@ from .. import models as _models +class CreateResourceSupportedProperties(_serialization.Model): + """Datadog resource can be created or not properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The ARM id of the subscription. + :vartype name: str + :ivar creation_supported: Indicates if selected subscription supports Datadog resource + creation, if not it is already being monitored for the selected organization via multi + subscription feature. + :vartype creation_supported: bool + """ + + _validation = { + "name": {"readonly": True}, + "creation_supported": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "creation_supported": {"key": "creationSupported", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.creation_supported = None + + +class CreateResourceSupportedResponse(_serialization.Model): + """Datadog resource can be created or not. + + :ivar properties: Represents the properties of the resource. + :vartype properties: ~azure.mgmt.datadog.models.CreateResourceSupportedProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "CreateResourceSupportedProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.CreateResourceSupportedProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Represents the properties of the resource. + :paramtype properties: ~azure.mgmt.datadog.models.CreateResourceSupportedProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class CreateResourceSupportedResponseList(_serialization.Model): + """CreateResourceSupportedResponseList. + + :ivar value: + :vartype value: list[~azure.mgmt.datadog.models.CreateResourceSupportedResponse] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[CreateResourceSupportedResponse]"}, + } + + def __init__( + self, *, value: Optional[List["_models.CreateResourceSupportedResponse"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.datadog.models.CreateResourceSupportedResponse] + """ + super().__init__(**kwargs) + self.value = value + + class DatadogAgreementProperties(_serialization.Model): """Terms properties. @@ -61,8 +135,8 @@ def __init__( retrieve_datetime: Optional[datetime.datetime] = None, signature: Optional[str] = None, accepted: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword publisher: Publisher identifier string. :paramtype publisher: str @@ -125,7 +199,7 @@ class DatadogAgreementResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: Optional["_models.DatadogAgreementProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DatadogAgreementProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: Represents the properties of the resource. :paramtype properties: ~azure.mgmt.datadog.models.DatadogAgreementProperties @@ -157,8 +231,8 @@ def __init__( *, value: Optional[List["_models.DatadogAgreementResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.DatadogAgreementResource] @@ -203,8 +277,8 @@ def __init__( created_by: Optional[str] = None, name: Optional[str] = None, created: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The user that created the API key. :paramtype created_by: str @@ -237,8 +311,8 @@ class DatadogApiKeyListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DatadogApiKey"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DatadogApiKey"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.DatadogApiKey] @@ -255,7 +329,7 @@ class DatadogHost(_serialization.Model): :ivar name: The name of the host. :vartype name: str - :ivar aliases: The aliases for the host. + :ivar aliases: The aliases for the host installed via the Datadog agent. :vartype aliases: list[str] :ivar apps: The Datadog integrations reporting metrics for the host. :vartype apps: list[str] @@ -277,12 +351,12 @@ def __init__( aliases: Optional[List[str]] = None, apps: Optional[List[str]] = None, meta: Optional["_models.DatadogHostMetadata"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the host. :paramtype name: str - :keyword aliases: The aliases for the host. + :keyword aliases: The aliases for the host installed via the Datadog agent. :paramtype aliases: list[str] :keyword apps: The Datadog integrations reporting metrics for the host. :paramtype apps: list[str] @@ -311,8 +385,8 @@ class DatadogHostListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DatadogHost"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DatadogHost"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.DatadogHost] @@ -347,8 +421,8 @@ def __init__( agent_version: Optional[str] = None, install_method: Optional["_models.DatadogInstallMethod"] = None, logs_agent: Optional["_models.DatadogLogsAgent"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword agent_version: The agent version. :paramtype agent_version: str @@ -386,8 +460,8 @@ def __init__( tool: Optional[str] = None, tool_version: Optional[str] = None, installer_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tool: The tool. :paramtype tool: str @@ -413,7 +487,7 @@ class DatadogLogsAgent(_serialization.Model): "transport": {"key": "transport", "type": "str"}, } - def __init__(self, *, transport: Optional[str] = None, **kwargs): + def __init__(self, *, transport: Optional[str] = None, **kwargs: Any) -> None: """ :keyword transport: The transport. :paramtype transport: str @@ -477,8 +551,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: :paramtype sku: ~azure.mgmt.datadog.models.ResourceSku @@ -522,8 +596,8 @@ def __init__( *, value: Optional[List["_models.DatadogMonitorResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.DatadogMonitorResource] @@ -559,8 +633,8 @@ def __init__( properties: Optional["_models.MonitorUpdateProperties"] = None, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.ResourceSku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword properties: The set of properties that can be update in a PATCH request to a monitor resource. @@ -577,18 +651,19 @@ def __init__( class DatadogOrganizationProperties(_serialization.Model): - """Datadog organization properties. + """Specify the Datadog organization name. In the case of linking to existing organizations, Id, + ApiKey, and Applicationkey is required as well. :ivar name: Name of the Datadog organization. :vartype name: str :ivar id: Id of the Datadog organization. :vartype id: str - :ivar linking_auth_code: The auth code used to linking to an existing datadog organization. + :ivar linking_auth_code: The auth code used to linking to an existing Datadog organization. :vartype linking_auth_code: str :ivar linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :vartype linking_client_id: str - :ivar redirect_uri: The redirect uri for linking. + :ivar redirect_uri: The redirect URI for linking. :vartype redirect_uri: str :ivar api_key: Api key associated to the Datadog organization. :vartype api_key: str @@ -596,6 +671,10 @@ class DatadogOrganizationProperties(_serialization.Model): :vartype application_key: str :ivar enterprise_app_id: The Id of the Enterprise App used for Single sign on. :vartype enterprise_app_id: str + :ivar cspm: The configuration which describes the state of cloud security posture management. + This collects configuration information for all resources in a subscription and track + conformance to industry benchmarks. + :vartype cspm: bool """ _attribute_map = { @@ -607,6 +686,7 @@ class DatadogOrganizationProperties(_serialization.Model): "api_key": {"key": "apiKey", "type": "str"}, "application_key": {"key": "applicationKey", "type": "str"}, "enterprise_app_id": {"key": "enterpriseAppId", "type": "str"}, + "cspm": {"key": "cspm", "type": "bool"}, } def __init__( @@ -620,19 +700,20 @@ def __init__( api_key: Optional[str] = None, application_key: Optional[str] = None, enterprise_app_id: Optional[str] = None, - **kwargs - ): + cspm: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword name: Name of the Datadog organization. :paramtype name: str :keyword id: Id of the Datadog organization. :paramtype id: str - :keyword linking_auth_code: The auth code used to linking to an existing datadog organization. + :keyword linking_auth_code: The auth code used to linking to an existing Datadog organization. :paramtype linking_auth_code: str :keyword linking_client_id: The client_id from an existing in exchange for an auth token to link organization. :paramtype linking_client_id: str - :keyword redirect_uri: The redirect uri for linking. + :keyword redirect_uri: The redirect URI for linking. :paramtype redirect_uri: str :keyword api_key: Api key associated to the Datadog organization. :paramtype api_key: str @@ -640,6 +721,10 @@ def __init__( :paramtype application_key: str :keyword enterprise_app_id: The Id of the Enterprise App used for Single sign on. :paramtype enterprise_app_id: str + :keyword cspm: The configuration which describes the state of cloud security posture + management. This collects configuration information for all resources in a subscription and + track conformance to industry benchmarks. + :paramtype cspm: bool """ super().__init__(**kwargs) self.name = name @@ -650,6 +735,7 @@ def __init__( self.api_key = api_key self.application_key = application_key self.enterprise_app_id = enterprise_app_id + self.cspm = cspm class DatadogSetPasswordLink(_serialization.Model): @@ -663,7 +749,7 @@ class DatadogSetPasswordLink(_serialization.Model): "set_password_link": {"key": "setPasswordLink", "type": "str"}, } - def __init__(self, *, set_password_link: Optional[str] = None, **kwargs): + def __init__(self, *, set_password_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword set_password_link: :paramtype set_password_link: str @@ -706,8 +792,8 @@ def __init__( *, single_sign_on_state: Optional[Union[str, "_models.SingleSignOnStates"]] = None, enterprise_app_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword single_sign_on_state: Various states of the SSO resource. Known values are: "Initial", "Enable", "Disable", and "Existing". @@ -754,7 +840,7 @@ class DatadogSingleSignOnResource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, properties: Optional["_models.DatadogSingleSignOnProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.DatadogSingleSignOnProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: :paramtype properties: ~azure.mgmt.datadog.models.DatadogSingleSignOnProperties @@ -786,8 +872,8 @@ def __init__( *, value: Optional[List["_models.DatadogSingleSignOnResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.DatadogSingleSignOnResource] @@ -820,7 +906,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -860,7 +946,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -871,7 +957,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.datadog.models.ErrorDetail @@ -881,7 +968,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.datadog.models.ErrorDetail @@ -891,7 +978,8 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): 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 @@ -914,8 +1002,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 @@ -940,7 +1028,8 @@ class IdentityProperties(_serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :ivar type: Identity type. Known values are: "SystemAssigned" and "UserAssigned". + :ivar type: Specifies the identity type of the Datadog Monitor. At this time the only allowed + value is 'SystemAssigned'. Known values are: "SystemAssigned" and "UserAssigned". :vartype type: str or ~azure.mgmt.datadog.models.ManagedIdentityTypes """ @@ -955,9 +1044,10 @@ 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: Identity type. Known values are: "SystemAssigned" and "UserAssigned". + :keyword type: Specifies the identity type of the Datadog Monitor. At this time the only + allowed value is 'SystemAssigned'. Known values are: "SystemAssigned" and "UserAssigned". :paramtype type: str or ~azure.mgmt.datadog.models.ManagedIdentityTypes """ super().__init__(**kwargs) @@ -977,7 +1067,7 @@ class LinkedResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The ARM id of the linked resource. :paramtype id: str @@ -1001,8 +1091,8 @@ class LinkedResourceListResponse(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.LinkedResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.LinkedResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: Results of a list operation. :paramtype value: list[~azure.mgmt.datadog.models.LinkedResource] @@ -1046,8 +1136,8 @@ def __init__( send_subscription_logs: Optional[bool] = None, send_resource_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 @@ -1084,7 +1174,7 @@ class MetricRules(_serialization.Model): "filtering_tags": {"key": "filteringTags", "type": "[FilteringTag]"}, } - def __init__(self, *, filtering_tags: Optional[List["_models.FilteringTag"]] = None, **kwargs): + def __init__(self, *, filtering_tags: Optional[List["_models.FilteringTag"]] = None, **kwargs: Any) -> None: """ :keyword filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the @@ -1129,8 +1219,8 @@ def __init__( reason_for_metrics_status: Optional[str] = None, sending_logs: Optional[bool] = None, reason_for_logs_status: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ARM id of the resource. :paramtype id: str @@ -1168,8 +1258,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.datadog.models.MonitoredResource] @@ -1181,6 +1275,118 @@ def __init__( self.next_link = next_link +class MonitoredSubscription(_serialization.Model): + """The list of subscriptions and it's monitoring status by current Datadog monitor. + + :ivar subscription_id: The subscriptionId to be monitored. + :vartype subscription_id: str + :ivar status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", and + "Deleting". + :vartype status: str or ~azure.mgmt.datadog.models.Status + :ivar error: The reason of not monitoring the subscription. + :vartype error: str + :ivar tag_rules: Definition of the properties for a TagRules resource. + :vartype tag_rules: ~azure.mgmt.datadog.models.MonitoringTagRulesProperties + """ + + _attribute_map = { + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "tag_rules": {"key": "tagRules", "type": "MonitoringTagRulesProperties"}, + } + + def __init__( + self, + *, + subscription_id: Optional[str] = None, + status: Optional[Union[str, "_models.Status"]] = None, + error: Optional[str] = None, + tag_rules: Optional["_models.MonitoringTagRulesProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword subscription_id: The subscriptionId to be monitored. + :paramtype subscription_id: str + :keyword status: The state of monitoring. Known values are: "InProgress", "Active", "Failed", + and "Deleting". + :paramtype status: str or ~azure.mgmt.datadog.models.Status + :keyword error: The reason of not monitoring the subscription. + :paramtype error: str + :keyword tag_rules: Definition of the properties for a TagRules resource. + :paramtype tag_rules: ~azure.mgmt.datadog.models.MonitoringTagRulesProperties + """ + super().__init__(**kwargs) + self.subscription_id = subscription_id + self.status = status + self.error = error + self.tag_rules = tag_rules + + +class MonitoredSubscriptionProperties(_serialization.Model): + """The request to update subscriptions needed to be monitored by the Datadog monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the monitored subscription resource. + :vartype name: str + :ivar id: The id of the monitored subscription resource. + :vartype id: str + :ivar type: The type of the monitored subscription resource. + :vartype type: str + :ivar properties: The request to update subscriptions needed to be monitored by the Datadog + monitor resource. + :vartype properties: ~azure.mgmt.datadog.models.SubscriptionList + """ + + _validation = { + "name": {"readonly": True}, + "id": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "SubscriptionList"}, + } + + def __init__(self, *, properties: Optional["_models.SubscriptionList"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The request to update subscriptions needed to be monitored by the Datadog + monitor resource. + :paramtype properties: ~azure.mgmt.datadog.models.SubscriptionList + """ + super().__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.properties = properties + + +class MonitoredSubscriptionPropertiesList(_serialization.Model): + """MonitoredSubscriptionPropertiesList. + + :ivar value: + :vartype value: list[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[MonitoredSubscriptionProperties]"}, + } + + def __init__( + self, *, value: Optional[List["_models.MonitoredSubscriptionProperties"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + """ + super().__init__(**kwargs) + self.value = value + + class MonitoringTagRules(_serialization.Model): """Capture logs and metrics of Azure resources based on ARM tags. @@ -1213,7 +1419,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: Definition of the properties for a TagRules resource. :paramtype properties: ~azure.mgmt.datadog.models.MonitoringTagRulesProperties @@ -1241,8 +1447,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.datadog.models.MonitoringTagRules] @@ -1266,6 +1476,8 @@ class MonitoringTagRulesProperties(_serialization.Model): :vartype log_rules: ~azure.mgmt.datadog.models.LogRules :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. :vartype metric_rules: ~azure.mgmt.datadog.models.MetricRules + :ivar automuting: Configuration to enable/disable auto-muting flag. + :vartype automuting: bool """ _validation = { @@ -1276,6 +1488,7 @@ class MonitoringTagRulesProperties(_serialization.Model): "provisioning_state": {"key": "provisioningState", "type": "str"}, "log_rules": {"key": "logRules", "type": "LogRules"}, "metric_rules": {"key": "metricRules", "type": "MetricRules"}, + "automuting": {"key": "automuting", "type": "bool"}, } def __init__( @@ -1283,18 +1496,22 @@ def __init__( *, log_rules: Optional["_models.LogRules"] = None, metric_rules: Optional["_models.MetricRules"] = None, - **kwargs - ): + automuting: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword log_rules: Set of rules for sending logs for the Monitor resource. :paramtype log_rules: ~azure.mgmt.datadog.models.LogRules :keyword metric_rules: Set of rules for sending metrics for the Monitor resource. :paramtype metric_rules: ~azure.mgmt.datadog.models.MetricRules + :keyword automuting: Configuration to enable/disable auto-muting flag. + :paramtype automuting: bool """ super().__init__(**kwargs) self.provisioning_state = None self.log_rules = log_rules self.metric_rules = metric_rules + self.automuting = automuting class MonitorProperties(_serialization.Model): @@ -1313,10 +1530,12 @@ class MonitorProperties(_serialization.Model): values are: "Provisioning", "Active", "Suspended", and "Unsubscribed". :vartype marketplace_subscription_status: str or ~azure.mgmt.datadog.models.MarketplaceSubscriptionStatus - :ivar datadog_organization_properties: Datadog organization properties. + :ivar datadog_organization_properties: Specify the Datadog organization name. In the case of + linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. :vartype datadog_organization_properties: ~azure.mgmt.datadog.models.DatadogOrganizationProperties - :ivar user_info: User info. + :ivar user_info: Includes name, email and optionally, phone number. User Information can't be + null. :vartype user_info: ~azure.mgmt.datadog.models.UserInfo :ivar liftr_resource_category: Known values are: "Unknown" and "MonitorLogs". :vartype liftr_resource_category: str or ~azure.mgmt.datadog.models.LiftrResourceCategories @@ -1350,16 +1569,18 @@ def __init__( monitoring_status: Union[str, "_models.MonitoringStatus"] = "Enabled", datadog_organization_properties: Optional["_models.DatadogOrganizationProperties"] = None, user_info: Optional["_models.UserInfo"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Known values are: "Enabled" and "Disabled". :paramtype monitoring_status: str or ~azure.mgmt.datadog.models.MonitoringStatus - :keyword datadog_organization_properties: Datadog organization properties. + :keyword datadog_organization_properties: Specify the Datadog organization name. In the case of + linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. :paramtype datadog_organization_properties: ~azure.mgmt.datadog.models.DatadogOrganizationProperties - :keyword user_info: User info. + :keyword user_info: Includes name, email and optionally, phone number. User Information can't + be null. :paramtype user_info: ~azure.mgmt.datadog.models.UserInfo """ super().__init__(**kwargs) @@ -1378,20 +1599,36 @@ class MonitorUpdateProperties(_serialization.Model): :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Known values are: "Enabled" and "Disabled". :vartype monitoring_status: str or ~azure.mgmt.datadog.models.MonitoringStatus + :ivar cspm: The new cloud security posture management value of the monitor resource. This + collects configuration information for all resources in a subscription and track conformance to + industry benchmarks. + :vartype cspm: bool """ _attribute_map = { "monitoring_status": {"key": "monitoringStatus", "type": "str"}, + "cspm": {"key": "cspm", "type": "bool"}, } - def __init__(self, *, monitoring_status: Union[str, "_models.MonitoringStatus"] = "Enabled", **kwargs): + def __init__( + self, + *, + monitoring_status: Union[str, "_models.MonitoringStatus"] = "Enabled", + cspm: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Known values are: "Enabled" and "Disabled". :paramtype monitoring_status: str or ~azure.mgmt.datadog.models.MonitoringStatus + :keyword cspm: The new cloud security posture management value of the monitor resource. This + collects configuration information for all resources in a subscription and track conformance to + industry benchmarks. + :paramtype cspm: bool """ super().__init__(**kwargs) self.monitoring_status = monitoring_status + self.cspm = cspm class OperationDisplay(_serialization.Model): @@ -1421,8 +1658,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.Datadog. :paramtype provider: str @@ -1455,8 +1692,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.Datadog provider. :paramtype value: list[~azure.mgmt.datadog.models.OperationResult] @@ -1491,8 +1728,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, is_data_action: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. :paramtype name: str @@ -1512,7 +1749,8 @@ class ResourceSku(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Name of the SKU. Required. + :ivar name: Name of the SKU in {PlanId} format. For Terraform, the only allowed value is + 'linking'. Required. :vartype name: str """ @@ -1524,15 +1762,50 @@ 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. + :keyword name: Name of the SKU in {PlanId} format. For Terraform, the only allowed value is + 'linking'. Required. :paramtype name: str """ super().__init__(**kwargs) self.name = name +class SubscriptionList(_serialization.Model): + """The request to update subscriptions needed to be monitored by the Datadog monitor resource. + + :ivar operation: The operation for the patch on the resource. Known values are: "AddBegin", + "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". + :vartype operation: str or ~azure.mgmt.datadog.models.Operation + :ivar monitored_subscription_list: List of subscriptions and the state of the monitoring. + :vartype monitored_subscription_list: list[~azure.mgmt.datadog.models.MonitoredSubscription] + """ + + _attribute_map = { + "operation": {"key": "operation", "type": "str"}, + "monitored_subscription_list": {"key": "monitoredSubscriptionList", "type": "[MonitoredSubscription]"}, + } + + def __init__( + self, + *, + operation: Optional[Union[str, "_models.Operation"]] = None, + monitored_subscription_list: Optional[List["_models.MonitoredSubscription"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword operation: The operation for the patch on the resource. Known values are: "AddBegin", + "AddComplete", "DeleteBegin", "DeleteComplete", and "Active". + :paramtype operation: str or ~azure.mgmt.datadog.models.Operation + :keyword monitored_subscription_list: List of subscriptions and the state of the monitoring. + :paramtype monitored_subscription_list: list[~azure.mgmt.datadog.models.MonitoredSubscription] + """ + super().__init__(**kwargs) + self.operation = operation + self.monitored_subscription_list = monitored_subscription_list + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -1570,8 +1843,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 @@ -1598,7 +1871,7 @@ def __init__( class UserInfo(_serialization.Model): - """User info. + """Includes name, email and optionally, phone number. User Information can't be null. :ivar name: Name of the user. :vartype name: str @@ -1626,8 +1899,8 @@ def __init__( name: Optional[str] = None, email_address: Optional[str] = None, phone_number: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the user. :paramtype name: str diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py index e8bd1df388c8..8370b25c3643 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/__init__.py @@ -7,21 +7,25 @@ # -------------------------------------------------------------------------- from ._marketplace_agreements_operations import MarketplaceAgreementsOperations +from ._creation_supported_operations import CreationSupportedOperations from ._monitors_operations import MonitorsOperations from ._operations import Operations from ._tag_rules_operations import TagRulesOperations from ._single_sign_on_configurations_operations import SingleSignOnConfigurationsOperations +from ._monitored_subscriptions_operations import MonitoredSubscriptionsOperations 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__ = [ "MarketplaceAgreementsOperations", + "CreationSupportedOperations", "MonitorsOperations", "Operations", "TagRulesOperations", "SingleSignOnConfigurationsOperations", + "MonitoredSubscriptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_creation_supported_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_creation_supported_operations.py new file mode 100644 index 000000000000..a0e0768bfebf --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_creation_supported_operations.py @@ -0,0 +1,261 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, *, datadog_organization_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["datadogOrganizationId"] = _SERIALIZER.query("datadog_organization_id", datadog_organization_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(subscription_id: str, *, datadog_organization_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["datadogOrganizationId"] = _SERIALIZER.query("datadog_organization_id", datadog_organization_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CreationSupportedOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datadog.MicrosoftDatadogClient`'s + :attr:`creation_supported` 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") + + @distributed_trace + def list(self, datadog_organization_id: str, **kwargs: Any) -> Iterable["_models.CreateResourceSupportedResponse"]: + """Informs if the current subscription is being already monitored for selected Datadog + organization. + + Informs if the current subscription is being already monitored for selected Datadog + organization. + + :param datadog_organization_id: Datadog Organization Id. Required. + :type datadog_organization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CreateResourceSupportedResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datadog.models.CreateResourceSupportedResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CreateResourceSupportedResponseList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + datadog_organization_id=datadog_organization_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CreateResourceSupportedResponseList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses"} + + @distributed_trace + def get(self, datadog_organization_id: str, **kwargs: Any) -> _models.CreateResourceSupportedResponse: + """Informs if the current subscription is being already monitored for selected Datadog + organization. + + Informs if the current subscription is being already monitored for selected Datadog + organization. + + :param datadog_organization_id: Datadog Organization Id. Required. + :type datadog_organization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CreateResourceSupportedResponse or the result of cls(response) + :rtype: ~azure.mgmt.datadog.models.CreateResourceSupportedResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CreateResourceSupportedResponse] = kwargs.pop("cls", None) + + request = build_get_request( + subscription_id=self._config.subscription_id, + datadog_organization_id=datadog_organization_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CreateResourceSupportedResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses/default"} diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py index d7c9b0bcd6f9..5797d7b1bb7a 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_marketplace_agreements_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,8 +65,8 @@ def build_create_or_update_request(subscription_id: str, **kwargs: Any) -> HttpR _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-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +75,7 @@ def build_create_or_update_request(subscription_id: str, **kwargs: Any) -> HttpR "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,10 +122,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DatadogAgreementResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogAgreementResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogAgreementResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -150,7 +144,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 @@ -166,7 +160,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 @@ -174,14 +168,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,7 +189,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements"} @overload def create_or_update( @@ -246,7 +241,7 @@ def create_or_update( Create Datadog marketplace agreement in the subscription. - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogAgreementResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogAgreementResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -267,16 +262,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogAgreementResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogAgreementResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -295,10 +288,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,4 +309,6 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_subscriptions_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_subscriptions_operations.py new file mode 100644 index 000000000000..e9d9855bc75b --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_subscriptions_operations.py @@ -0,0 +1,1017 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, monitor_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_createor_update_request( + resource_group_name: str, monitor_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, monitor_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, monitor_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class MonitoredSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.datadog.MicrosoftDatadogClient`'s + :attr:`monitored_subscriptions` 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") + + @distributed_trace + def list( + self, resource_group_name: str, monitor_name: str, **kwargs: Any + ) -> Iterable["_models.MonitoredSubscriptionProperties"]: + """List the subscriptions currently being monitored by the Datadog monitor resource. + + List the subscriptions currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredSubscriptionProperties or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredSubscriptionPropertiesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionPropertiesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions" + } + + @distributed_trace + def get( + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> _models.MonitoredSubscriptionProperties: + """List the subscriptions currently being monitored by the Datadog monitor resource. + + List the subscriptions currently being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoredSubscriptionProperties or the result of cls(response) + :rtype: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + def _createor_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> Optional[_models.MonitoredSubscriptionProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MonitoredSubscriptionProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "MonitoredSubscriptionProperties") + else: + _json = None + + request = build_createor_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._createor_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _createor_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_createor_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Add the subscriptions that should be monitored by the Datadog monitor resource. + + Add the subscriptions that should be monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO type. Default value is + None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._createor_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_createor_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + def _update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> Optional[_models.MonitoredSubscriptionProperties]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.MonitoredSubscriptionProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "MonitoredSubscriptionProperties") + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[_models.MonitoredSubscriptionProperties] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Default value is None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + body: Optional[Union[_models.MonitoredSubscriptionProperties, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.MonitoredSubscriptionProperties]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: The configuration name. Only 'default' value is supported. Required. + :type configuration_name: str + :param body: Is either a MonitoredSubscriptionProperties type or a IO type. Default value is + None. + :type body: ~azure.mgmt.datadog.models.MonitoredSubscriptionProperties or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoredSubscriptionProperties or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.datadog.models.MonitoredSubscriptionProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoredSubscriptionProperties] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MonitoredSubscriptionProperties", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, monitor_name: str, configuration_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Updates the subscriptions that are being monitored by the Datadog monitor resource. + + Updates the subscriptions that are being monitored by the Datadog monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param monitor_name: Monitor resource name. Required. + :type monitor_name: str + :param configuration_name: Configuration name. Required. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: 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, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py index 2f174a0c7c91..6b84b197c7ab 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitors_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_list_api_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +61,7 @@ def build_list_api_keys_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +78,7 @@ def build_get_default_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +94,7 @@ def build_get_default_key_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,8 +111,8 @@ def build_set_default_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +128,7 @@ def build_set_default_key_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +147,7 @@ def build_list_hosts_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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +163,7 @@ def build_list_hosts_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +180,7 @@ def build_list_linked_resources_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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +196,7 @@ def build_list_linked_resources_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -217,7 +213,7 @@ def build_list_monitored_resources_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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +229,7 @@ def build_list_monitored_resources_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -248,7 +244,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +253,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +268,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -287,7 +283,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,7 +298,7 @@ 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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +314,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 = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -335,8 +331,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +348,7 @@ def build_create_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -371,8 +367,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -388,7 +384,7 @@ def build_update_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -407,7 +403,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -423,7 +419,7 @@ def build_delete_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -440,7 +436,7 @@ def build_refresh_set_password_link_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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -456,7 +452,7 @@ def build_refresh_set_password_link_request( "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -507,10 +503,8 @@ def list_api_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogApiKeyListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogApiKeyListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -533,7 +527,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 @@ -549,7 +543,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 @@ -557,14 +551,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogApiKeyListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -577,7 +572,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_api_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys"} # type: ignore + list_api_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys" + } @distributed_trace def get_default_key(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DatadogApiKey: @@ -606,10 +603,8 @@ def get_default_key(self, resource_group_name: str, monitor_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogApiKey] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogApiKey] = kwargs.pop("cls", None) request = build_get_default_key_request( resource_group_name=resource_group_name, @@ -621,10 +616,11 @@ def get_default_key(self, resource_group_name: str, monitor_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,7 +637,9 @@ def get_default_key(self, resource_group_name: str, monitor_name: str, **kwargs: return deserialized - get_default_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey"} # type: ignore + get_default_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey" + } @overload def set_default_key( # pylint: disable=inconsistent-return-statements @@ -720,7 +718,7 @@ def set_default_key( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogApiKey type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogApiKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -741,16 +739,14 @@ def set_default_key( # 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -771,10 +767,11 @@ def set_default_key( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -787,7 +784,9 @@ def set_default_key( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - set_default_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey"} # type: ignore + set_default_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey" + } @distributed_trace def list_hosts(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> Iterable["_models.DatadogHost"]: @@ -808,10 +807,8 @@ def list_hosts(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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogHostListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogHostListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -834,7 +831,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 @@ -850,7 +847,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 @@ -858,14 +855,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -878,7 +876,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_hosts.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts"} # type: ignore + list_hosts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts" + } @distributed_trace def list_linked_resources( @@ -901,10 +901,8 @@ def list_linked_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkedResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkedResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -927,7 +925,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 @@ -943,7 +941,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 @@ -951,14 +949,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("LinkedResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -971,7 +970,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_linked_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources"} # type: ignore + list_linked_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources" + } @distributed_trace def list_monitored_resources( @@ -994,10 +995,8 @@ def list_monitored_resources( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoredResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoredResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1020,7 +1019,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 @@ -1036,7 +1035,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 @@ -1044,14 +1043,15 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1064,7 +1064,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_monitored_resources.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources"} # type: ignore + list_monitored_resources.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources" + } @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DatadogMonitorResource"]: @@ -1081,10 +1083,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.DatadogMonitorResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1105,7 +1105,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 @@ -1121,7 +1121,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 @@ -1129,14 +1129,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1149,7 +1150,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors"} @distributed_trace def list_by_resource_group( @@ -1171,10 +1172,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1196,7 +1195,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 @@ -1212,7 +1211,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 @@ -1220,14 +1219,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1240,7 +1240,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.Datadog/monitors"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + } @distributed_trace def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.DatadogMonitorResource: @@ -1269,10 +1271,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -1284,10 +1284,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1304,7 +1305,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.Datadog/monitors/{monitorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } def _create_initial( self, @@ -1324,16 +1327,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1354,10 +1355,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1374,11 +1376,13 @@ def _create_initial( deserialized = self._deserialize("DatadogMonitorResource", 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.Datadog/monitors/{monitorName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @overload def begin_create( @@ -1473,7 +1477,7 @@ def begin_create( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogMonitorResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogMonitorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1494,16 +1498,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = 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, @@ -1523,9 +1525,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: @@ -1537,9 +1539,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.Datadog/monitors/{monitorName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } def _update_initial( self, @@ -1559,16 +1563,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1589,10 +1591,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1609,11 +1612,13 @@ def _update_initial( deserialized = self._deserialize("DatadogMonitorResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @overload def begin_update( @@ -1708,7 +1713,8 @@ def begin_update( :type resource_group_name: str :param monitor_name: Monitor resource name. Required. :type monitor_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogMonitorResourceUpdateParameters type or a IO type. Default + value is None. :type body: ~azure.mgmt.datadog.models.DatadogMonitorResourceUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1729,16 +1735,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogMonitorResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogMonitorResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, @@ -1758,7 +1762,7 @@ def get_long_running_output(pipeline_response): return deserialized 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: @@ -1770,9 +1774,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, monitor_name: str, **kwargs: Any @@ -1788,10 +1794,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1803,10 +1807,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1819,7 +1824,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.Datadog/monitors/{monitorName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1847,13 +1854,11 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1871,7 +1876,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: @@ -1883,9 +1888,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}" + } @distributed_trace def refresh_set_password_link( @@ -1916,10 +1923,8 @@ def refresh_set_password_link( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSetPasswordLink] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSetPasswordLink] = kwargs.pop("cls", None) request = build_refresh_set_password_link_request( resource_group_name=resource_group_name, @@ -1931,10 +1936,11 @@ def refresh_set_password_link( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1951,4 +1957,6 @@ def refresh_set_password_link( return deserialized - refresh_set_password_link.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink"} # type: ignore + refresh_set_password_link.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_operations.py index 09ee711e7f1c..ed18776511d1 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,9 +76,9 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: - """List all operations provided by Microsoft.Datadog for the 2022-06-01 api version. + """List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - List all operations provided by Microsoft.Datadog for the 2022-06-01 api version. + List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) @@ -93,10 +88,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +125,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,14 +133,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,4 +154,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Datadog/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Datadog/operations"} diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py index de08aef3b093..5a88c13a00e7 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_single_sign_on_configurations_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,7 @@ 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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,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 = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,8 +76,8 @@ 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-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +94,7 @@ def build_create_or_update_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +113,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +130,7 @@ def build_get_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,10 +182,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResourceListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSingleSignOnResourceListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -212,7 +206,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 @@ -228,7 +222,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 @@ -236,14 +230,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DatadogSingleSignOnResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,7 +251,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations" + } def _create_or_update_initial( self, @@ -277,16 +274,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogSingleSignOnResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -308,10 +303,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -328,11 +324,13 @@ def _create_or_update_initial( deserialized = self._deserialize("DatadogSingleSignOnResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } @overload def begin_create_or_update( @@ -436,7 +434,7 @@ def begin_create_or_update( :type monitor_name: str :param configuration_name: Configuration name. Required. :type configuration_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a DatadogSingleSignOnResource type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.DatadogSingleSignOnResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -457,16 +455,14 @@ def begin_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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DatadogSingleSignOnResource] = 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_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, monitor_name=monitor_name, configuration_name=configuration_name, @@ -487,9 +483,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: @@ -501,9 +497,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_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } @distributed_trace def get( @@ -536,10 +534,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DatadogSingleSignOnResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DatadogSingleSignOnResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -552,10 +548,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,4 +569,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py index 12b0d7d97ddb..d1fd49468820 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_tag_rules_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ 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-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +57,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 = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,8 +74,8 @@ 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-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,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 = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +111,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +128,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 = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,10 +179,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRulesListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringTagRulesListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -209,7 +203,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 @@ -225,7 +219,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 @@ -233,14 +227,15 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,7 +248,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules" + } @overload def create_or_update( @@ -341,7 +338,7 @@ def create_or_update( :type monitor_name: str :param rule_set_name: Rule set name. Required. :type rule_set_name: str - :param body: Is either a model type or a IO type. Default value is None. + :param body: Is either a MonitoringTagRules type or a IO type. Default value is None. :type body: ~azure.mgmt.datadog.models.MonitoringTagRules or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -362,16 +359,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -393,10 +388,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +409,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}" + } @distributed_trace def get( @@ -446,10 +444,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MonitoringTagRules] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MonitoringTagRules] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -462,10 +458,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,4 +479,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}" + } diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get_default_key.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_get_default_key.py similarity index 93% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get_default_key.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_get_default_key.py index 441ee200dce1..fd6958a4a4c2 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get_default_key.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_get_default_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_get_default_key.py + python api_keys_get_default_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, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/ApiKeys_GetDefaultKey.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_api_keys.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_list.py similarity index 93% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_api_keys.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_list.py index de3d38f91eeb..1b5aa8bb182c 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_api_keys.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_list_api_keys.py + python api_keys_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/ApiKeys_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_set_default_key.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_set_default_key.py similarity index 89% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_set_default_key.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_set_default_key.py index ae340229b323..89432f4efc8b 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_set_default_key.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/api_keys_set_default_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_set_default_key.py + python api_keys_set_default_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, @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.monitors.set_default_key( + client.monitors.set_default_key( resource_group_name="myResourceGroup", monitor_name="myMonitor", ) - print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/ApiKeys_SetDefaultKey.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_get.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_get.py new file mode 100644 index 000000000000..1479d121e4c9 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_get.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.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python creation_supported_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.creation_supported.get( + datadog_organization_id="00000000-0000-0000-0000", + ) + print(response) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_list.py new file mode 100644 index 000000000000..e798940790f7 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/creation_supported_list.py @@ -0,0 +1,41 @@ +# 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.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python creation_supported_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, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.creation_supported.list( + datadog_organization_id="00000000-0000-0000-0000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_hosts.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/hosts_list.py similarity index 94% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_hosts.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/hosts_list.py index 1f7ba72d71a1..e03f314d03f6 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_hosts.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/hosts_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_list_hosts.py + python hosts_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Hosts_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_linked_resources.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/linked_resources_list.py similarity index 93% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_linked_resources.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/linked_resources_list.py index 15ed35980dcf..5fb9f7c45d8b 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_linked_resources.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/linked_resources_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_list_linked_resources.py + python linked_resources_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/LinkedResources_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create_or_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create.py similarity index 92% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create_or_update.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create.py index b88b3cb1325b..8acc7b69ae0f 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create_or_update.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python marketplace_agreements_create_or_update.py + python marketplace_agreements_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, @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/MarketplaceAgreements_Create.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_list.py index a46456969434..26d36b5b2d89 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_list.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/marketplace_agreements_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/MarketplaceAgreements_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_monitored_resources.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_resources_list.py similarity index 93% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_monitored_resources.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_resources_list.py index 885e98141fc3..5588abb17136 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_monitored_resources.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_resources_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_list_monitored_resources.py + python monitored_resources_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/MonitoredResources_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_createor_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_createor_update.py new file mode 100644 index 000000000000..aa507e4eb18a --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_createor_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python monitored_subscriptions_createor_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, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.monitored_subscriptions.begin_createor_update( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + configuration_name="default", + ).result() + print(response) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_delete.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_delete.py new file mode 100644 index 000000000000..f195c109b9ef --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_delete.py @@ -0,0 +1,41 @@ +# 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.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python monitored_subscriptions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.monitored_subscriptions.begin_delete( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + configuration_name="default", + ).result() + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_get.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_get.py new file mode 100644 index 000000000000..a95ad9747585 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python monitored_subscriptions_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.monitored_subscriptions.get( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + configuration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_list.py new file mode 100644 index 000000000000..cf5dc87d42fb --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python monitored_subscriptions_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, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.monitored_subscriptions.list( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_update.py new file mode 100644 index 000000000000..411acdf9cd8c --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitored_subscriptions_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.datadog import MicrosoftDatadogClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-datadog +# USAGE + python monitored_subscriptions_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, + 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 = MicrosoftDatadogClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.monitored_subscriptions.begin_update( + resource_group_name="myResourceGroup", + monitor_name="myMonitor", + configuration_name="default", + ).result() + print(response) + + +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_create.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_create.py index d555576a2664..a6ff3e6116ce 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_create.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_create.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_Create.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_delete.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_delete.py index 330d1cb8d1d8..33f2b01de4c9 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_delete.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.monitors.begin_delete( + client.monitors.begin_delete( resource_group_name="myResourceGroup", monitor_name="myMonitor", ).result() - print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_Delete.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get.py index 4808842430d2..c41fcdeebc04 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_Get.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list.py index b9d8c331e1cd..14028bbad6c5 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_by_resource_group.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_by_resource_group.py index e374e87e0ae2..fde140500fe5 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_by_resource_group.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_ListByResourceGroup.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_update.py index 183aac13032b..de9a94f8acb7 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_update.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Monitors_Update.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/operations_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/operations_list.py index ab08dbf764f4..a21ad41e0296 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/operations_list.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/Operations_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_refresh_set_password_link.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/refresh_set_password_get.py similarity index 92% rename from sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_refresh_set_password_link.py rename to sdk/datadog/azure-mgmt-datadog/generated_samples/refresh_set_password_get.py index e448d603f299..9d64da5e82f3 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/monitors_refresh_set_password_link.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/refresh_set_password_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-datadog # USAGE - python monitors_refresh_set_password_link.py + python refresh_set_password_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/RefreshSetPassword_Get.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_create_or_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_create_or_update.py index d4e8426d3b42..ee33ccae0ed1 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_create_or_update.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_get.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_get.py index 8e78a5813fad..aba00f1a0e65 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_get.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/SingleSignOnConfigurations_Get.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_list.py index 47b35b14a4cc..0a81274ca5a7 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_list.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/single_sign_on_configurations_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/SingleSignOnConfigurations_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_create_or_update.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_create_or_update.py index 2f7e0ae0f59a..486ce2fc5caf 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_create_or_update.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/TagRules_CreateOrUpdate.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_get.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_get.py index 7eea3ef17097..cbc5df996daa 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_get.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/TagRules_Get.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_list.py b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_list.py index f7cc1bb56532..b5d83b8a09c3 100644 --- a/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_list.py +++ b/sdk/datadog/azure-mgmt-datadog/generated_samples/tag_rules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2022-06-01/examples/TagRules_List.json +# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.json if __name__ == "__main__": main()