diff --git a/sdk/datadog/azure-mgmt-datadog/_meta.json b/sdk/datadog/azure-mgmt-datadog/_meta.json index faceb1e82a31..445abeaa0952 100644 --- a/sdk/datadog/azure-mgmt-datadog/_meta.json +++ b/sdk/datadog/azure-mgmt-datadog/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "2e3f1e0c67ee7da1d681a26b6b23b888ce856695", + "commit": "93846d146949c64a070d272bcc67fa62d0863b8f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/datadog/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/datadog/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "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 4169586605e1..3797873b241b 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__init__.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._microsoft_datadog_client import MicrosoftDatadogClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['MicrosoftDatadogClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py index 478a11dc6a9e..0394de499911 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_configuration.py @@ -10,7 +10,9 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -18,7 +20,6 @@ from azure.core.credentials import TokenCredential -VERSION = "unknown" class MicrosoftDatadogClientConfiguration(Configuration): """Configuration for MicrosoftDatadogClient. @@ -39,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json index 4a028a690cc5..e43e952d082f 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_metadata.json @@ -5,13 +5,13 @@ "name": "MicrosoftDatadogClient", "filename": "_microsoft_datadog_client", "description": "MicrosoftDatadogClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftDatadogClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftDatadogClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftDatadogClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftDatadogClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "marketplace_agreements": "MarketplaceAgreementsOperations", 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 c0a09ac58aaa..2ea9d5a9eb1f 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 @@ -6,32 +6,29 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations, MonitorsOperations, Operations, SingleSignOnConfigurationsOperations, TagRulesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import MicrosoftDatadogClientConfiguration -from .operations import MarketplaceAgreementsOperations -from .operations import MonitorsOperations -from .operations import Operations -from .operations import TagRulesOperations -from .operations import SingleSignOnConfigurationsOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class MicrosoftDatadogClient(object): """MicrosoftDatadogClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations - :vartype marketplace_agreements: microsoft_datadog_client.operations.MarketplaceAgreementsOperations + :vartype marketplace_agreements: + microsoft_datadog_client.operations.MarketplaceAgreementsOperations :ivar monitors: MonitorsOperations operations :vartype monitors: microsoft_datadog_client.operations.MonitorsOperations :ivar operations: Operations operations @@ -39,61 +36,66 @@ class MicrosoftDatadogClient(object): :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: microsoft_datadog_client.operations.TagRulesOperations :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations - :vartype single_sign_on_configurations: microsoft_datadog_client.operations.SingleSignOnConfigurationsOperations + :vartype single_sign_on_configurations: + microsoft_datadog_client.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) + self._config = MicrosoftDatadogClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.marketplace_agreements = MarketplaceAgreementsOperations(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.marketplace_agreements = MarketplaceAgreementsOperations( - 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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_patch.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_version.py index 48944bf3938a..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.0.0" +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 b43d36247a58..f38f0a71dab9 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 @@ -8,3 +8,8 @@ from ._microsoft_datadog_client import MicrosoftDatadogClient __all__ = ['MicrosoftDatadogClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_configuration.py index a389c345bfe6..ced4ec5fd8ae 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 @@ -10,13 +10,14 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class MicrosoftDatadogClientConfiguration(Configuration): """Configuration for MicrosoftDatadogClient. @@ -36,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/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 b15a27c9dc6c..ed39d7bfd8d7 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 @@ -6,30 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import MicrosoftDatadogClientConfiguration +from .operations import MarketplaceAgreementsOperations, MonitorsOperations, Operations, SingleSignOnConfigurationsOperations, TagRulesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MicrosoftDatadogClientConfiguration -from .operations import MarketplaceAgreementsOperations -from .operations import MonitorsOperations -from .operations import Operations -from .operations import TagRulesOperations -from .operations import SingleSignOnConfigurationsOperations -from .. import models - - -class MicrosoftDatadogClient(object): +class MicrosoftDatadogClient: """MicrosoftDatadogClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations - :vartype marketplace_agreements: microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations + :vartype marketplace_agreements: + microsoft_datadog_client.aio.operations.MarketplaceAgreementsOperations :ivar monitors: MonitorsOperations operations :vartype monitors: microsoft_datadog_client.aio.operations.MonitorsOperations :ivar operations: Operations operations @@ -37,59 +34,64 @@ class MicrosoftDatadogClient(object): :ivar tag_rules: TagRulesOperations operations :vartype tag_rules: microsoft_datadog_client.aio.operations.TagRulesOperations :ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations - :vartype single_sign_on_configurations: microsoft_datadog_client.aio.operations.SingleSignOnConfigurationsOperations + :vartype single_sign_on_configurations: + microsoft_datadog_client.aio.operations.SingleSignOnConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftDatadogClientConfiguration(credential, subscription_id, **kwargs) + self._config = MicrosoftDatadogClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.marketplace_agreements = MarketplaceAgreementsOperations(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.marketplace_agreements = MarketplaceAgreementsOperations( - 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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_patch.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_api_keys_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_api_keys_operations.py deleted file mode 100644 index 13be2dd477c3..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_api_keys_operations.py +++ /dev/null @@ -1,252 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ApiKeysOperations: - """ApiKeysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["_models.DatadogApiKeyListResponse"]: - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listApiKeys'} # type: ignore - - async def get_default_key( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "_models.DatadogApiKey": - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKey"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - async def set_default_key( - self, - resource_group_name: str, - monitor_name: str, - body: Optional["_models.DatadogApiKey"] = None, - **kwargs - ) -> None: - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param body: - :type body: ~microsoft_datadog_client.models.DatadogApiKey - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if body is not None: - body_content = self._serialize.body(body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_hosts_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_hosts_operations.py deleted file mode 100644 index 5461c5845ef4..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_hosts_operations.py +++ /dev/null @@ -1,120 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class HostsOperations: - """HostsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["_models.DatadogHostListResponse"]: - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogHostListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listHosts'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_linked_resources_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_linked_resources_operations.py deleted file mode 100644 index 659e0d19a203..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_linked_resources_operations.py +++ /dev/null @@ -1,120 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class LinkedResourcesOperations: - """LinkedResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["_models.LinkedResourceListResponse"]: - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listLinkedResources'} # type: ignore 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 ad57c39674c1..f8e7976c4f89 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._marketplace_agreements_operations import build_create_or_update_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -50,8 +56,10 @@ def list( List Datadog marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogAgreementResourceListResponse"] @@ -59,34 +67,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogAgreementResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,17 +102,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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/agreements'} # type: ignore + @distributed_trace_async async def create_or_update( self, body: Optional["_models.DatadogAgreementResource"] = None, @@ -131,39 +136,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogAgreementResource') + _json = self._serialize.body(body, 'DatadogAgreementResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) @@ -172,4 +167,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_resources_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_resources_operations.py deleted file mode 100644 index ccf5b54107a4..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_monitored_resources_operations.py +++ /dev/null @@ -1,120 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MonitoredResourcesOperations: - """MonitoredResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> AsyncIterable["_models.MonitoredResourceListResponse"]: - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listMonitoredResources'} # type: ignore 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 f32b7f54921b..0a66122244c8 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitors_operations import build_create_request_initial, build_delete_request_initial, build_get_default_key_request, build_get_request, build_list_api_keys_request, build_list_by_resource_group_request, build_list_hosts_request, build_list_linked_resources_request, build_list_monitored_resources_request, build_list_request, build_refresh_set_password_link_request, build_set_default_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_api_keys( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list_api_keys( :param monitor_name: Monitor resource name. :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] @@ -67,36 +75,33 @@ def list_api_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_api_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_api_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_api_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_api_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) + deserialized = self._deserialize("DatadogApiKeyListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +114,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + @distributed_trace_async async def get_default_key( self, resource_group_name: str, @@ -144,33 +151,23 @@ async def get_default_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.get_default_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogApiKey', pipeline_response) @@ -179,8 +176,11 @@ async def get_default_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + @distributed_trace_async async def set_default_key( self, resource_group_name: str, @@ -208,41 +208,31 @@ async def set_default_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogApiKey') + _json = self._serialize.body(body, 'DatadogApiKey') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_set_default_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self.set_default_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -250,6 +240,8 @@ async def set_default_key( set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + @distributed_trace def list_hosts( self, resource_group_name: str, @@ -265,8 +257,10 @@ def list_hosts( :param monitor_name: Monitor resource name. :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 DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] + :return: An iterator like instance of either DatadogHostListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogHostListResponse"] @@ -274,36 +268,33 @@ def list_hosts( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_hosts.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_hosts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) + deserialized = self._deserialize("DatadogHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -316,17 +307,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + @distributed_trace def list_linked_resources( self, resource_group_name: str, @@ -342,8 +335,10 @@ def list_linked_resources( :param monitor_name: Monitor resource name. :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :return: An iterator like instance of either LinkedResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] @@ -351,36 +346,33 @@ def list_linked_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_linked_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_linked_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_linked_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_linked_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) + deserialized = self._deserialize("LinkedResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -393,17 +385,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + @distributed_trace def list_monitored_resources( self, resource_group_name: str, @@ -419,8 +413,10 @@ def list_monitored_resources( :param monitor_name: Monitor resource name. :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 MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] @@ -428,36 +424,33 @@ def list_monitored_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_monitored_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_monitored_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + deserialized = self._deserialize("MonitoredResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -470,17 +463,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -490,8 +485,10 @@ def list( List all monitors under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResourceListResponse"] @@ -499,34 +496,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -539,17 +531,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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/monitors'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -562,8 +556,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResourceListResponse"] @@ -571,35 +567,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -612,17 +604,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -647,33 +641,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -682,8 +666,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -696,42 +682,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogMonitorResource') + _json = self._serialize.body(body, 'DatadogMonitorResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -743,8 +718,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -764,15 +742,20 @@ async def begin_create( :type body: ~microsoft_datadog_client.models.DatadogMonitorResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DatadogMonitorResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -784,27 +767,21 @@ async def begin_create( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -816,6 +793,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore async def _update_initial( @@ -830,42 +808,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + _json = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -877,8 +844,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -898,15 +868,20 @@ async def begin_update( :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DatadogMonitorResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DatadogMonitorResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -918,27 +893,21 @@ async def begin_update( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -950,6 +919,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore async def _delete_initial( @@ -963,40 +933,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -1013,15 +974,17 @@ async def begin_delete( :type monitor_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1035,21 +998,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1061,8 +1017,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + @distributed_trace_async async def refresh_set_password_link( self, resource_group_name: str, @@ -1087,33 +1045,23 @@ async def refresh_set_password_link( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.refresh_set_password_link.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_set_password_link_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.refresh_set_password_link.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) @@ -1122,4 +1070,6 @@ async def refresh_set_password_link( return cls(pipeline_response, deserialized, {}) return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore + 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 217975c1076c..486c1fb3e965 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,12 +99,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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 ) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_refresh_set_password_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_refresh_set_password_operations.py deleted file mode 100644 index e769f6892469..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/aio/operations/_refresh_set_password_operations.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RefreshSetPasswordOperations: - """RefreshSetPasswordOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - monitor_name: str, - **kwargs - ) -> "_models.DatadogSetPasswordLink": - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSetPasswordLink"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore 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 622ba246132e..32b0b2ed2e06 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._single_sign_on_configurations_operations import build_create_or_update_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list( :param monitor_name: Monitor resource name. :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 DatadogSingleSignOnResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogSingleSignOnResourceListResponse] + :return: An iterator like instance of either DatadogSingleSignOnResourceListResponse or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.DatadogSingleSignOnResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSingleSignOnResourceListResponse"] @@ -67,36 +75,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogSingleSignOnResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogSingleSignOnResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,12 +114,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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 ) @@ -133,43 +139,32 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') + _json = self._serialize.body(body, 'DatadogSingleSignOnResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) @@ -181,8 +176,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -205,15 +203,20 @@ async def begin_create_or_update( :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DatadogSingleSignOnResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogSingleSignOnResource] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DatadogSingleSignOnResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSingleSignOnResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -226,28 +229,21 @@ async def begin_create_or_update( monitor_name=monitor_name, configuration_name=configuration_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -259,8 +255,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,34 +286,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) @@ -324,4 +312,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + 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 46ea07db089f..b0869901b70d 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tag_rules_operations import build_create_or_update_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param monitor_name: Monitor resource name. :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 MonitoringTagRulesListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoringTagRulesListResponse] + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_datadog_client.models.MonitoringTagRulesListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringTagRulesListResponse"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringTagRulesListResponse', pipeline_response) + deserialized = self._deserialize("MonitoringTagRulesListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/tagRules'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -148,42 +155,32 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'MonitoringTagRules') + _json = self._serialize.body(body, 'MonitoringTagRules') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -192,8 +189,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -221,34 +221,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -257,4 +247,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + 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 eba8198b7a4b..8b499544fa42 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 @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,19 +20,19 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LiftrResourceCategories(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LiftrResourceCategories(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNKNOWN = "Unknown" MONITOR_LOGS = "MonitorLogs" -class ManagedIdentityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity type """ SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" -class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MarketplaceSubscriptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. """ @@ -57,14 +42,14 @@ class MarketplaceSubscriptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str SUSPENDED = "Suspended" UNSUBSCRIBED = "Unsubscribed" -class MonitoringStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying if the resource monitoring is enabled or disabled. """ ENABLED = "Enabled" DISABLED = "Disabled" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCEPTED = "Accepted" CREATING = "Creating" @@ -76,7 +61,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" NOT_SPECIFIED = "NotSpecified" -class SingleSignOnStates(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SingleSignOnStates(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Various states of the SSO resource """ @@ -85,7 +70,7 @@ class SingleSignOnStates(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISABLE = "Disable" EXISTING = "Existing" -class TagAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TagAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Valid actions for a filtering tag. Exclusion takes priority over inclusion. """ diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py index 2b3b38fdf7a7..99d4766f861c 100644 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py +++ b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/_models.py @@ -13,23 +13,23 @@ class DatadogAgreementProperties(msrest.serialization.Model): """Terms properties. - :param publisher: Publisher identifier string. - :type publisher: str - :param product: Product identifier string. - :type product: str - :param plan: Plan identifier string. - :type plan: str - :param license_text_link: Link to HTML with Microsoft and Publisher terms. - :type license_text_link: str - :param privacy_policy_link: Link to the privacy policy of the publisher. - :type privacy_policy_link: str - :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty - if Accepted is false. - :type retrieve_datetime: ~datetime.datetime - :param signature: Terms signature. - :type signature: str - :param accepted: If any version of the terms have been accepted, otherwise false. - :type accepted: bool + :ivar publisher: Publisher identifier string. + :vartype publisher: str + :ivar product: Product identifier string. + :vartype product: str + :ivar plan: Plan identifier string. + :vartype plan: str + :ivar license_text_link: Link to HTML with Microsoft and Publisher terms. + :vartype license_text_link: str + :ivar privacy_policy_link: Link to the privacy policy of the publisher. + :vartype privacy_policy_link: str + :ivar retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty if + Accepted is false. + :vartype retrieve_datetime: ~datetime.datetime + :ivar signature: Terms signature. + :vartype signature: str + :ivar accepted: If any version of the terms have been accepted, otherwise false. + :vartype accepted: bool """ _attribute_map = { @@ -47,6 +47,25 @@ def __init__( self, **kwargs ): + """ + :keyword publisher: Publisher identifier string. + :paramtype publisher: str + :keyword product: Product identifier string. + :paramtype product: str + :keyword plan: Plan identifier string. + :paramtype plan: str + :keyword license_text_link: Link to HTML with Microsoft and Publisher terms. + :paramtype license_text_link: str + :keyword privacy_policy_link: Link to the privacy policy of the publisher. + :paramtype privacy_policy_link: str + :keyword retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :paramtype retrieve_datetime: ~datetime.datetime + :keyword signature: Terms signature. + :paramtype signature: str + :keyword accepted: If any version of the terms have been accepted, otherwise false. + :paramtype accepted: bool + """ super(DatadogAgreementProperties, self).__init__(**kwargs) self.publisher = kwargs.get('publisher', None) self.product = kwargs.get('product', None) @@ -69,8 +88,8 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Represents the properties of the resource. - :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar properties: Represents the properties of the resource. + :vartype properties: ~microsoft_datadog_client.models.DatadogAgreementProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -94,6 +113,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Represents the properties of the resource. + :paramtype properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ super(DatadogAgreementResource, self).__init__(**kwargs) self.id = None self.name = None @@ -105,10 +128,10 @@ def __init__( class DatadogAgreementResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -120,6 +143,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -130,14 +159,14 @@ class DatadogApiKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param key: Required. The value of the API key. - :type key: str - :param created: The time of creation of the API key. - :type created: str + :ivar created_by: The user that created the API key. + :vartype created_by: str + :ivar name: The name of the API key. + :vartype name: str + :ivar key: Required. The value of the API key. + :vartype key: str + :ivar created: The time of creation of the API key. + :vartype created: str """ _validation = { @@ -155,6 +184,16 @@ def __init__( self, **kwargs ): + """ + :keyword created_by: The user that created the API key. + :paramtype created_by: str + :keyword name: The name of the API key. + :paramtype name: str + :keyword key: Required. The value of the API key. + :paramtype key: str + :keyword created: The time of creation of the API key. + :paramtype created: str + """ super(DatadogApiKey, self).__init__(**kwargs) self.created_by = kwargs.get('created_by', None) self.name = kwargs.get('name', None) @@ -165,10 +204,10 @@ def __init__( class DatadogApiKeyListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogApiKey] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogApiKey] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -180,6 +219,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogApiKey] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogApiKeyListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -188,14 +233,14 @@ def __init__( class DatadogHost(msrest.serialization.Model): """DatadogHost. - :param name: The name of the host. - :type name: str - :param aliases: The aliases for the host. - :type aliases: list[str] - :param apps: The Datadog integrations reporting metrics for the host. - :type apps: list[str] - :param meta: - :type meta: ~microsoft_datadog_client.models.DatadogHostMetadata + :ivar name: The name of the host. + :vartype name: str + :ivar aliases: The aliases for the host. + :vartype aliases: list[str] + :ivar apps: The Datadog integrations reporting metrics for the host. + :vartype apps: list[str] + :ivar meta: + :vartype meta: ~microsoft_datadog_client.models.DatadogHostMetadata """ _attribute_map = { @@ -209,6 +254,16 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of the host. + :paramtype name: str + :keyword aliases: The aliases for the host. + :paramtype aliases: list[str] + :keyword apps: The Datadog integrations reporting metrics for the host. + :paramtype apps: list[str] + :keyword meta: + :paramtype meta: ~microsoft_datadog_client.models.DatadogHostMetadata + """ super(DatadogHost, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.aliases = kwargs.get('aliases', None) @@ -219,10 +274,10 @@ def __init__( class DatadogHostListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogHost] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogHost] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -234,6 +289,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogHost] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogHostListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -242,12 +303,12 @@ def __init__( class DatadogHostMetadata(msrest.serialization.Model): """DatadogHostMetadata. - :param agent_version: The agent version. - :type agent_version: str - :param install_method: - :type install_method: ~microsoft_datadog_client.models.DatadogInstallMethod - :param logs_agent: - :type logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar install_method: + :vartype install_method: ~microsoft_datadog_client.models.DatadogInstallMethod + :ivar logs_agent: + :vartype logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent """ _attribute_map = { @@ -260,6 +321,14 @@ def __init__( self, **kwargs ): + """ + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword install_method: + :paramtype install_method: ~microsoft_datadog_client.models.DatadogInstallMethod + :keyword logs_agent: + :paramtype logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent + """ super(DatadogHostMetadata, self).__init__(**kwargs) self.agent_version = kwargs.get('agent_version', None) self.install_method = kwargs.get('install_method', None) @@ -269,12 +338,12 @@ def __init__( class DatadogInstallMethod(msrest.serialization.Model): """DatadogInstallMethod. - :param tool: The tool. - :type tool: str - :param tool_version: The tool version. - :type tool_version: str - :param installer_version: The installer version. - :type installer_version: str + :ivar tool: The tool. + :vartype tool: str + :ivar tool_version: The tool version. + :vartype tool_version: str + :ivar installer_version: The installer version. + :vartype installer_version: str """ _attribute_map = { @@ -287,6 +356,14 @@ def __init__( self, **kwargs ): + """ + :keyword tool: The tool. + :paramtype tool: str + :keyword tool_version: The tool version. + :paramtype tool_version: str + :keyword installer_version: The installer version. + :paramtype installer_version: str + """ super(DatadogInstallMethod, self).__init__(**kwargs) self.tool = kwargs.get('tool', None) self.tool_version = kwargs.get('tool_version', None) @@ -296,8 +373,8 @@ def __init__( class DatadogLogsAgent(msrest.serialization.Model): """DatadogLogsAgent. - :param transport: The transport. - :type transport: str + :ivar transport: The transport. + :vartype transport: str """ _attribute_map = { @@ -308,6 +385,10 @@ def __init__( self, **kwargs ): + """ + :keyword transport: The transport. + :paramtype transport: str + """ super(DatadogLogsAgent, self).__init__(**kwargs) self.transport = kwargs.get('transport', None) @@ -325,16 +406,16 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str - :param sku: - :type sku: ~microsoft_datadog_client.models.ResourceSku - :param properties: Properties specific to the monitor resource. - :type properties: ~microsoft_datadog_client.models.MonitorProperties - :param identity: - :type identity: ~microsoft_datadog_client.models.IdentityProperties - :param tags: A set of tags. Dictionary of :code:``. - :type tags: dict[str, str] - :param location: Required. - :type location: str + :ivar sku: + :vartype sku: ~microsoft_datadog_client.models.ResourceSku + :ivar properties: Properties specific to the monitor resource. + :vartype properties: ~microsoft_datadog_client.models.MonitorProperties + :ivar identity: + :vartype identity: ~microsoft_datadog_client.models.IdentityProperties + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar location: Required. + :vartype location: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -363,6 +444,18 @@ def __init__( self, **kwargs ): + """ + :keyword sku: + :paramtype sku: ~microsoft_datadog_client.models.ResourceSku + :keyword properties: Properties specific to the monitor resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitorProperties + :keyword identity: + :paramtype identity: ~microsoft_datadog_client.models.IdentityProperties + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword location: Required. + :paramtype location: str + """ super(DatadogMonitorResource, self).__init__(**kwargs) self.id = None self.name = None @@ -378,10 +471,10 @@ def __init__( class DatadogMonitorResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogMonitorResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogMonitorResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -393,6 +486,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogMonitorResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogMonitorResourceListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -401,13 +500,13 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. - :param properties: The set of properties that can be update in a PATCH request to a monitor + :ivar properties: The set of properties that can be update in a PATCH request to a monitor resource. - :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties - :param tags: A set of tags. The new tags of the monitor resource. - :type tags: dict[str, str] - :param sku: - :type sku: ~microsoft_datadog_client.models.ResourceSku + :vartype properties: ~microsoft_datadog_client.models.MonitorUpdateProperties + :ivar tags: A set of tags. The new tags of the monitor resource. + :vartype tags: dict[str, str] + :ivar sku: + :vartype sku: ~microsoft_datadog_client.models.ResourceSku """ _attribute_map = { @@ -420,6 +519,15 @@ def __init__( self, **kwargs ): + """ + :keyword properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitorUpdateProperties + :keyword tags: A set of tags. The new tags of the monitor resource. + :paramtype tags: dict[str, str] + :keyword sku: + :paramtype sku: ~microsoft_datadog_client.models.ResourceSku + """ super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.tags = kwargs.get('tags', None) @@ -435,19 +543,19 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :vartype name: str :ivar id: Id of the Datadog organization. :vartype id: str - :param linking_auth_code: The auth code used to linking to an existing datadog organization. - :type linking_auth_code: str - :param linking_client_id: The client_id from an existing in exchange for an auth token to link + :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. - :type linking_client_id: str - :param redirect_uri: The redirect uri for linking. - :type redirect_uri: str - :param api_key: Api key associated to the Datadog organization. - :type api_key: str - :param application_key: Application key associated to the Datadog organization. - :type application_key: str - :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. - :type enterprise_app_id: str + :vartype linking_client_id: str + :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 + :ivar application_key: Application key associated to the Datadog organization. + :vartype application_key: str + :ivar enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :vartype enterprise_app_id: str """ _validation = { @@ -470,6 +578,21 @@ def __init__( self, **kwargs ): + """ + :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. + :paramtype redirect_uri: str + :keyword api_key: Api key associated to the Datadog organization. + :paramtype api_key: str + :keyword application_key: Application key associated to the Datadog organization. + :paramtype application_key: str + :keyword enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :paramtype enterprise_app_id: str + """ super(DatadogOrganizationProperties, self).__init__(**kwargs) self.name = None self.id = None @@ -484,8 +607,8 @@ def __init__( class DatadogSetPasswordLink(msrest.serialization.Model): """DatadogSetPasswordLink. - :param set_password_link: - :type set_password_link: str + :ivar set_password_link: + :vartype set_password_link: str """ _attribute_map = { @@ -496,6 +619,10 @@ def __init__( self, **kwargs ): + """ + :keyword set_password_link: + :paramtype set_password_link: str + """ super(DatadogSetPasswordLink, self).__init__(**kwargs) self.set_password_link = kwargs.get('set_password_link', None) @@ -505,14 +632,14 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param single_sign_on_state: Various states of the SSO resource. Possible values include: + :ivar single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". - :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates - :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. - :type enterprise_app_id: str + :vartype single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates + :ivar enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :vartype enterprise_app_id: str :ivar single_sign_on_url: The login URL specific to this Datadog Organization. :vartype single_sign_on_url: str """ @@ -533,6 +660,13 @@ def __init__( self, **kwargs ): + """ + :keyword single_sign_on_state: Various states of the SSO resource. Possible values include: + "Initial", "Enable", "Disable", "Existing". + :paramtype single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates + :keyword enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :paramtype enterprise_app_id: str + """ super(DatadogSingleSignOnProperties, self).__init__(**kwargs) self.provisioning_state = None self.single_sign_on_state = kwargs.get('single_sign_on_state', None) @@ -551,8 +685,8 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar properties: + :vartype properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -576,6 +710,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: + :paramtype properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + """ super(DatadogSingleSignOnResource, self).__init__(**kwargs) self.id = None self.name = None @@ -587,10 +725,10 @@ def __init__( class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -602,6 +740,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogSingleSignOnResourceListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -632,6 +776,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -674,6 +820,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -685,8 +833,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~microsoft_datadog_client.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~microsoft_datadog_client.models.ErrorDetail """ _attribute_map = { @@ -697,6 +845,10 @@ def __init__( self, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~microsoft_datadog_client.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = kwargs.get('error', None) @@ -704,13 +856,13 @@ def __init__( class FilteringTag(msrest.serialization.Model): """The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. - :param name: The name (also known as the key) of the tag. - :type name: str - :param value: The value of the tag. - :type value: str - :param action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + :ivar name: The name (also known as the key) of the tag. + :vartype name: str + :ivar value: The value of the tag. + :vartype value: str + :ivar action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. Possible values include: "Include", "Exclude". - :type action: str or ~microsoft_datadog_client.models.TagAction + :vartype action: str or ~microsoft_datadog_client.models.TagAction """ _attribute_map = { @@ -723,6 +875,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name (also known as the key) of the tag. + :paramtype name: str + :keyword value: The value of the tag. + :paramtype value: str + :keyword action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :paramtype action: str or ~microsoft_datadog_client.models.TagAction + """ super(FilteringTag, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -738,8 +899,8 @@ class IdentityProperties(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + :ivar type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :vartype type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes """ _validation = { @@ -757,6 +918,10 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :paramtype type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -766,8 +931,8 @@ def __init__( class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. - :param id: The ARM id of the linked resource. - :type id: str + :ivar id: The ARM id of the linked resource. + :vartype id: str """ _attribute_map = { @@ -778,6 +943,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: The ARM id of the linked resource. + :paramtype id: str + """ super(LinkedResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) @@ -785,10 +954,10 @@ def __init__( class LinkedResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.LinkedResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.LinkedResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -800,6 +969,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.LinkedResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(LinkedResourceListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -808,19 +983,19 @@ def __init__( class LogRules(msrest.serialization.Model): """Set of rules for sending logs for the Monitor resource. - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :vartype send_aad_logs: bool + :ivar send_subscription_logs: Flag specifying if Azure subscription logs should be sent for the Monitor resource. - :type send_resource_logs: bool - :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + :vartype send_subscription_logs: bool + :ivar send_resource_logs: Flag specifying if Azure resource logs should be sent for the Monitor + resource. + :vartype send_resource_logs: bool + :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :vartype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] """ _attribute_map = { @@ -834,6 +1009,21 @@ def __init__( self, **kwargs ): + """ + :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :paramtype send_aad_logs: bool + :keyword send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :paramtype send_subscription_logs: bool + :keyword send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :paramtype send_resource_logs: bool + :keyword filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :paramtype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ super(LogRules, self).__init__(**kwargs) self.send_aad_logs = kwargs.get('send_aad_logs', None) self.send_subscription_logs = kwargs.get('send_subscription_logs', None) @@ -844,11 +1034,11 @@ def __init__( class MetricRules(msrest.serialization.Model): """Set of rules for sending metrics for the Monitor resource. - :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + :ivar 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 list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :vartype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] """ _attribute_map = { @@ -859,6 +1049,13 @@ def __init__( self, **kwargs ): + """ + :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 + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :paramtype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ super(MetricRules, self).__init__(**kwargs) self.filtering_tags = kwargs.get('filtering_tags', None) @@ -866,18 +1063,18 @@ def __init__( class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. - :param id: The ARM id of the resource. - :type id: str - :param sending_metrics: Flag indicating if resource is sending metrics to Datadog. - :type sending_metrics: bool - :param reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_metrics: Flag indicating if resource is sending metrics to Datadog. + :vartype sending_metrics: bool + :ivar reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is not sending). - :type reason_for_metrics_status: str - :param sending_logs: Flag indicating if resource is sending logs to Datadog. - :type sending_logs: bool - :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + :vartype reason_for_metrics_status: str + :ivar sending_logs: Flag indicating if resource is sending logs to Datadog. + :vartype sending_logs: bool + :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not sending). - :type reason_for_logs_status: str + :vartype reason_for_logs_status: str """ _attribute_map = { @@ -892,6 +1089,20 @@ def __init__( self, **kwargs ): + """ + :keyword id: The ARM id of the resource. + :paramtype id: str + :keyword sending_metrics: Flag indicating if resource is sending metrics to Datadog. + :paramtype sending_metrics: bool + :keyword reason_for_metrics_status: Reason for why the resource is sending metrics (or why it + is not sending). + :paramtype reason_for_metrics_status: str + :keyword sending_logs: Flag indicating if resource is sending logs to Datadog. + :paramtype sending_logs: bool + :keyword reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :paramtype reason_for_logs_status: str + """ super(MonitoredResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.sending_metrics = kwargs.get('sending_metrics', None) @@ -903,10 +1114,10 @@ def __init__( class MonitoredResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.MonitoredResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.MonitoredResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -918,6 +1129,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.MonitoredResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(MonitoredResourceListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -934,8 +1151,8 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param properties: Definition of the properties for a TagRules resource. - :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar properties: Definition of the properties for a TagRules resource. + :vartype properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -959,6 +1176,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Definition of the properties for a TagRules resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + """ super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None @@ -970,10 +1191,10 @@ def __init__( class MonitoringTagRulesListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.MonitoringTagRules] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.MonitoringTagRules] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -985,6 +1206,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.MonitoringTagRules] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(MonitoringTagRulesListResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -995,13 +1222,13 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param log_rules: Set of rules for sending logs for the Monitor resource. - :type log_rules: ~microsoft_datadog_client.models.LogRules - :param metric_rules: Set of rules for sending metrics for the Monitor resource. - :type metric_rules: ~microsoft_datadog_client.models.MetricRules + :ivar log_rules: Set of rules for sending logs for the Monitor resource. + :vartype log_rules: ~microsoft_datadog_client.models.LogRules + :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. + :vartype metric_rules: ~microsoft_datadog_client.models.MetricRules """ _validation = { @@ -1018,6 +1245,12 @@ def __init__( self, **kwargs ): + """ + :keyword log_rules: Set of rules for sending logs for the Monitor resource. + :paramtype log_rules: ~microsoft_datadog_client.models.LogRules + :keyword metric_rules: Set of rules for sending metrics for the Monitor resource. + :paramtype metric_rules: ~microsoft_datadog_client.models.MetricRules + """ super(MonitoringTagRulesProperties, self).__init__(**kwargs) self.provisioning_state = None self.log_rules = kwargs.get('log_rules', None) @@ -1029,23 +1262,23 @@ class MonitorProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. Possible values include: "Provisioning", "Active", "Suspended", "Unsubscribed". :vartype marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: Datadog organization properties. - :type datadog_organization_properties: + :ivar datadog_organization_properties: Datadog organization properties. + :vartype datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: User info. - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :ivar user_info: User info. + :vartype user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or ~microsoft_datadog_client.models.LiftrResourceCategories :ivar liftr_resource_preference: The priority of the resource. @@ -1073,6 +1306,16 @@ def __init__( self, **kwargs ): + """ + :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :keyword datadog_organization_properties: Datadog organization properties. + :paramtype datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :keyword user_info: User info. + :paramtype user_info: ~microsoft_datadog_client.models.UserInfo + """ super(MonitorProperties, self).__init__(**kwargs) self.provisioning_state = None self.monitoring_status = kwargs.get('monitoring_status', "Enabled") @@ -1086,9 +1329,9 @@ def __init__( class MonitorUpdateProperties(msrest.serialization.Model): """The set of properties that can be update in a PATCH request to a monitor resource. - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { @@ -1099,6 +1342,11 @@ def __init__( self, **kwargs ): + """ + :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ super(MonitorUpdateProperties, self).__init__(**kwargs) self.monitoring_status = kwargs.get('monitoring_status', "Enabled") @@ -1106,14 +1354,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: Service provider, i.e., Microsoft.Datadog. - :type provider: str - :param resource: Type on which the operation is performed, e.g., 'monitors'. - :type resource: str - :param operation: Operation type, e.g., read, write, delete, etc. - :type operation: str - :param description: Description of the operation, e.g., 'Write monitors'. - :type description: str + :ivar provider: Service provider, i.e., Microsoft.Datadog. + :vartype provider: str + :ivar resource: Type on which the operation is performed, e.g., 'monitors'. + :vartype resource: str + :ivar operation: Operation type, e.g., read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation, e.g., 'Write monitors'. + :vartype description: str """ _attribute_map = { @@ -1127,6 +1375,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Service provider, i.e., Microsoft.Datadog. + :paramtype provider: str + :keyword resource: Type on which the operation is performed, e.g., 'monitors'. + :paramtype resource: str + :keyword operation: Operation type, e.g., read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation, e.g., 'Write monitors'. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1137,10 +1395,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of GET request to list the Microsoft.Datadog operations. - :param value: List of operations supported by the Microsoft.Datadog provider. - :type value: list[~microsoft_datadog_client.models.OperationResult] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: List of operations supported by the Microsoft.Datadog provider. + :vartype value: list[~microsoft_datadog_client.models.OperationResult] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -1152,6 +1410,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: List of operations supported by the Microsoft.Datadog provider. + :paramtype value: list[~microsoft_datadog_client.models.OperationResult] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1160,12 +1424,12 @@ def __init__( class OperationResult(msrest.serialization.Model): """A Microsoft.Datadog REST API operation. - :param name: Operation name, i.e., {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~microsoft_datadog_client.models.OperationDisplay - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool + :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~microsoft_datadog_client.models.OperationDisplay + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool """ _attribute_map = { @@ -1178,6 +1442,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~microsoft_datadog_client.models.OperationDisplay + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ super(OperationResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1189,8 +1461,8 @@ class ResourceSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the SKU. - :type name: str + :ivar name: Required. Name of the SKU. + :vartype name: str """ _validation = { @@ -1205,6 +1477,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the SKU. + :paramtype name: str + """ super(ResourceSku, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1212,20 +1488,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~microsoft_datadog_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1241,6 +1517,22 @@ def __init__( self, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -1253,12 +1545,12 @@ def __init__( class UserInfo(msrest.serialization.Model): """User info. - :param name: Name of the user. - :type name: str - :param email_address: Email of the user used by Datadog for contacting them if needed. - :type email_address: str - :param phone_number: Phone number of the user used by Datadog for contacting them if needed. - :type phone_number: str + :ivar name: Name of the user. + :vartype name: str + :ivar email_address: Email of the user used by Datadog for contacting them if needed. + :vartype email_address: str + :ivar phone_number: Phone number of the user used by Datadog for contacting them if needed. + :vartype phone_number: str """ _validation = { @@ -1277,6 +1569,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the user. + :paramtype name: str + :keyword email_address: Email of the user used by Datadog for contacting them if needed. + :paramtype email_address: str + :keyword phone_number: Phone number of the user used by Datadog for contacting them if needed. + :paramtype phone_number: str + """ super(UserInfo, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.email_address = kwargs.get('email_address', None) 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 3db8c9d98d68..bc27ff044bf1 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 @@ -18,23 +18,23 @@ class DatadogAgreementProperties(msrest.serialization.Model): """Terms properties. - :param publisher: Publisher identifier string. - :type publisher: str - :param product: Product identifier string. - :type product: str - :param plan: Plan identifier string. - :type plan: str - :param license_text_link: Link to HTML with Microsoft and Publisher terms. - :type license_text_link: str - :param privacy_policy_link: Link to the privacy policy of the publisher. - :type privacy_policy_link: str - :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty - if Accepted is false. - :type retrieve_datetime: ~datetime.datetime - :param signature: Terms signature. - :type signature: str - :param accepted: If any version of the terms have been accepted, otherwise false. - :type accepted: bool + :ivar publisher: Publisher identifier string. + :vartype publisher: str + :ivar product: Product identifier string. + :vartype product: str + :ivar plan: Plan identifier string. + :vartype plan: str + :ivar license_text_link: Link to HTML with Microsoft and Publisher terms. + :vartype license_text_link: str + :ivar privacy_policy_link: Link to the privacy policy of the publisher. + :vartype privacy_policy_link: str + :ivar retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty if + Accepted is false. + :vartype retrieve_datetime: ~datetime.datetime + :ivar signature: Terms signature. + :vartype signature: str + :ivar accepted: If any version of the terms have been accepted, otherwise false. + :vartype accepted: bool """ _attribute_map = { @@ -61,6 +61,25 @@ def __init__( accepted: Optional[bool] = None, **kwargs ): + """ + :keyword publisher: Publisher identifier string. + :paramtype publisher: str + :keyword product: Product identifier string. + :paramtype product: str + :keyword plan: Plan identifier string. + :paramtype plan: str + :keyword license_text_link: Link to HTML with Microsoft and Publisher terms. + :paramtype license_text_link: str + :keyword privacy_policy_link: Link to the privacy policy of the publisher. + :paramtype privacy_policy_link: str + :keyword retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :paramtype retrieve_datetime: ~datetime.datetime + :keyword signature: Terms signature. + :paramtype signature: str + :keyword accepted: If any version of the terms have been accepted, otherwise false. + :paramtype accepted: bool + """ super(DatadogAgreementProperties, self).__init__(**kwargs) self.publisher = publisher self.product = product @@ -83,8 +102,8 @@ class DatadogAgreementResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Represents the properties of the resource. - :type properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + :ivar properties: Represents the properties of the resource. + :vartype properties: ~microsoft_datadog_client.models.DatadogAgreementProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -110,6 +129,10 @@ def __init__( properties: Optional["DatadogAgreementProperties"] = None, **kwargs ): + """ + :keyword properties: Represents the properties of the resource. + :paramtype properties: ~microsoft_datadog_client.models.DatadogAgreementProperties + """ super(DatadogAgreementResource, self).__init__(**kwargs) self.id = None self.name = None @@ -121,10 +144,10 @@ def __init__( class DatadogAgreementResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogAgreementResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -139,6 +162,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogAgreementResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogAgreementResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -149,14 +178,14 @@ class DatadogApiKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param created_by: The user that created the API key. - :type created_by: str - :param name: The name of the API key. - :type name: str - :param key: Required. The value of the API key. - :type key: str - :param created: The time of creation of the API key. - :type created: str + :ivar created_by: The user that created the API key. + :vartype created_by: str + :ivar name: The name of the API key. + :vartype name: str + :ivar key: Required. The value of the API key. + :vartype key: str + :ivar created: The time of creation of the API key. + :vartype created: str """ _validation = { @@ -179,6 +208,16 @@ def __init__( created: Optional[str] = None, **kwargs ): + """ + :keyword created_by: The user that created the API key. + :paramtype created_by: str + :keyword name: The name of the API key. + :paramtype name: str + :keyword key: Required. The value of the API key. + :paramtype key: str + :keyword created: The time of creation of the API key. + :paramtype created: str + """ super(DatadogApiKey, self).__init__(**kwargs) self.created_by = created_by self.name = name @@ -189,10 +228,10 @@ def __init__( class DatadogApiKeyListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogApiKey] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogApiKey] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -207,6 +246,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogApiKey] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogApiKeyListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -215,14 +260,14 @@ def __init__( class DatadogHost(msrest.serialization.Model): """DatadogHost. - :param name: The name of the host. - :type name: str - :param aliases: The aliases for the host. - :type aliases: list[str] - :param apps: The Datadog integrations reporting metrics for the host. - :type apps: list[str] - :param meta: - :type meta: ~microsoft_datadog_client.models.DatadogHostMetadata + :ivar name: The name of the host. + :vartype name: str + :ivar aliases: The aliases for the host. + :vartype aliases: list[str] + :ivar apps: The Datadog integrations reporting metrics for the host. + :vartype apps: list[str] + :ivar meta: + :vartype meta: ~microsoft_datadog_client.models.DatadogHostMetadata """ _attribute_map = { @@ -241,6 +286,16 @@ def __init__( meta: Optional["DatadogHostMetadata"] = None, **kwargs ): + """ + :keyword name: The name of the host. + :paramtype name: str + :keyword aliases: The aliases for the host. + :paramtype aliases: list[str] + :keyword apps: The Datadog integrations reporting metrics for the host. + :paramtype apps: list[str] + :keyword meta: + :paramtype meta: ~microsoft_datadog_client.models.DatadogHostMetadata + """ super(DatadogHost, self).__init__(**kwargs) self.name = name self.aliases = aliases @@ -251,10 +306,10 @@ def __init__( class DatadogHostListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogHost] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogHost] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -269,6 +324,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogHost] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogHostListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -277,12 +338,12 @@ def __init__( class DatadogHostMetadata(msrest.serialization.Model): """DatadogHostMetadata. - :param agent_version: The agent version. - :type agent_version: str - :param install_method: - :type install_method: ~microsoft_datadog_client.models.DatadogInstallMethod - :param logs_agent: - :type logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent + :ivar agent_version: The agent version. + :vartype agent_version: str + :ivar install_method: + :vartype install_method: ~microsoft_datadog_client.models.DatadogInstallMethod + :ivar logs_agent: + :vartype logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent """ _attribute_map = { @@ -299,6 +360,14 @@ def __init__( logs_agent: Optional["DatadogLogsAgent"] = None, **kwargs ): + """ + :keyword agent_version: The agent version. + :paramtype agent_version: str + :keyword install_method: + :paramtype install_method: ~microsoft_datadog_client.models.DatadogInstallMethod + :keyword logs_agent: + :paramtype logs_agent: ~microsoft_datadog_client.models.DatadogLogsAgent + """ super(DatadogHostMetadata, self).__init__(**kwargs) self.agent_version = agent_version self.install_method = install_method @@ -308,12 +377,12 @@ def __init__( class DatadogInstallMethod(msrest.serialization.Model): """DatadogInstallMethod. - :param tool: The tool. - :type tool: str - :param tool_version: The tool version. - :type tool_version: str - :param installer_version: The installer version. - :type installer_version: str + :ivar tool: The tool. + :vartype tool: str + :ivar tool_version: The tool version. + :vartype tool_version: str + :ivar installer_version: The installer version. + :vartype installer_version: str """ _attribute_map = { @@ -330,6 +399,14 @@ def __init__( installer_version: Optional[str] = None, **kwargs ): + """ + :keyword tool: The tool. + :paramtype tool: str + :keyword tool_version: The tool version. + :paramtype tool_version: str + :keyword installer_version: The installer version. + :paramtype installer_version: str + """ super(DatadogInstallMethod, self).__init__(**kwargs) self.tool = tool self.tool_version = tool_version @@ -339,8 +416,8 @@ def __init__( class DatadogLogsAgent(msrest.serialization.Model): """DatadogLogsAgent. - :param transport: The transport. - :type transport: str + :ivar transport: The transport. + :vartype transport: str """ _attribute_map = { @@ -353,6 +430,10 @@ def __init__( transport: Optional[str] = None, **kwargs ): + """ + :keyword transport: The transport. + :paramtype transport: str + """ super(DatadogLogsAgent, self).__init__(**kwargs) self.transport = transport @@ -370,16 +451,16 @@ class DatadogMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str - :param sku: - :type sku: ~microsoft_datadog_client.models.ResourceSku - :param properties: Properties specific to the monitor resource. - :type properties: ~microsoft_datadog_client.models.MonitorProperties - :param identity: - :type identity: ~microsoft_datadog_client.models.IdentityProperties - :param tags: A set of tags. Dictionary of :code:``. - :type tags: dict[str, str] - :param location: Required. - :type location: str + :ivar sku: + :vartype sku: ~microsoft_datadog_client.models.ResourceSku + :ivar properties: Properties specific to the monitor resource. + :vartype properties: ~microsoft_datadog_client.models.MonitorProperties + :ivar identity: + :vartype identity: ~microsoft_datadog_client.models.IdentityProperties + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar location: Required. + :vartype location: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -414,6 +495,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword sku: + :paramtype sku: ~microsoft_datadog_client.models.ResourceSku + :keyword properties: Properties specific to the monitor resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitorProperties + :keyword identity: + :paramtype identity: ~microsoft_datadog_client.models.IdentityProperties + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword location: Required. + :paramtype location: str + """ super(DatadogMonitorResource, self).__init__(**kwargs) self.id = None self.name = None @@ -429,10 +522,10 @@ def __init__( class DatadogMonitorResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogMonitorResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogMonitorResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -447,6 +540,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogMonitorResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogMonitorResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -455,13 +554,13 @@ def __init__( class DatadogMonitorResourceUpdateParameters(msrest.serialization.Model): """The parameters for a PATCH request to a monitor resource. - :param properties: The set of properties that can be update in a PATCH request to a monitor + :ivar properties: The set of properties that can be update in a PATCH request to a monitor resource. - :type properties: ~microsoft_datadog_client.models.MonitorUpdateProperties - :param tags: A set of tags. The new tags of the monitor resource. - :type tags: dict[str, str] - :param sku: - :type sku: ~microsoft_datadog_client.models.ResourceSku + :vartype properties: ~microsoft_datadog_client.models.MonitorUpdateProperties + :ivar tags: A set of tags. The new tags of the monitor resource. + :vartype tags: dict[str, str] + :ivar sku: + :vartype sku: ~microsoft_datadog_client.models.ResourceSku """ _attribute_map = { @@ -478,6 +577,15 @@ def __init__( sku: Optional["ResourceSku"] = None, **kwargs ): + """ + :keyword properties: The set of properties that can be update in a PATCH request to a monitor + resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitorUpdateProperties + :keyword tags: A set of tags. The new tags of the monitor resource. + :paramtype tags: dict[str, str] + :keyword sku: + :paramtype sku: ~microsoft_datadog_client.models.ResourceSku + """ super(DatadogMonitorResourceUpdateParameters, self).__init__(**kwargs) self.properties = properties self.tags = tags @@ -493,19 +601,19 @@ class DatadogOrganizationProperties(msrest.serialization.Model): :vartype name: str :ivar id: Id of the Datadog organization. :vartype id: str - :param linking_auth_code: The auth code used to linking to an existing datadog organization. - :type linking_auth_code: str - :param linking_client_id: The client_id from an existing in exchange for an auth token to link + :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. - :type linking_client_id: str - :param redirect_uri: The redirect uri for linking. - :type redirect_uri: str - :param api_key: Api key associated to the Datadog organization. - :type api_key: str - :param application_key: Application key associated to the Datadog organization. - :type application_key: str - :param enterprise_app_id: The Id of the Enterprise App used for Single sign on. - :type enterprise_app_id: str + :vartype linking_client_id: str + :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 + :ivar application_key: Application key associated to the Datadog organization. + :vartype application_key: str + :ivar enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :vartype enterprise_app_id: str """ _validation = { @@ -535,6 +643,21 @@ def __init__( enterprise_app_id: Optional[str] = None, **kwargs ): + """ + :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. + :paramtype redirect_uri: str + :keyword api_key: Api key associated to the Datadog organization. + :paramtype api_key: str + :keyword application_key: Application key associated to the Datadog organization. + :paramtype application_key: str + :keyword enterprise_app_id: The Id of the Enterprise App used for Single sign on. + :paramtype enterprise_app_id: str + """ super(DatadogOrganizationProperties, self).__init__(**kwargs) self.name = None self.id = None @@ -549,8 +672,8 @@ def __init__( class DatadogSetPasswordLink(msrest.serialization.Model): """DatadogSetPasswordLink. - :param set_password_link: - :type set_password_link: str + :ivar set_password_link: + :vartype set_password_link: str """ _attribute_map = { @@ -563,6 +686,10 @@ def __init__( set_password_link: Optional[str] = None, **kwargs ): + """ + :keyword set_password_link: + :paramtype set_password_link: str + """ super(DatadogSetPasswordLink, self).__init__(**kwargs) self.set_password_link = set_password_link @@ -572,14 +699,14 @@ class DatadogSingleSignOnProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param single_sign_on_state: Various states of the SSO resource. Possible values include: + :ivar single_sign_on_state: Various states of the SSO resource. Possible values include: "Initial", "Enable", "Disable", "Existing". - :type single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates - :param enterprise_app_id: The Id of the Enterprise App used for Single sign-on. - :type enterprise_app_id: str + :vartype single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates + :ivar enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :vartype enterprise_app_id: str :ivar single_sign_on_url: The login URL specific to this Datadog Organization. :vartype single_sign_on_url: str """ @@ -603,6 +730,13 @@ def __init__( enterprise_app_id: Optional[str] = None, **kwargs ): + """ + :keyword single_sign_on_state: Various states of the SSO resource. Possible values include: + "Initial", "Enable", "Disable", "Existing". + :paramtype single_sign_on_state: str or ~microsoft_datadog_client.models.SingleSignOnStates + :keyword enterprise_app_id: The Id of the Enterprise App used for Single sign-on. + :paramtype enterprise_app_id: str + """ super(DatadogSingleSignOnProperties, self).__init__(**kwargs) self.provisioning_state = None self.single_sign_on_state = single_sign_on_state @@ -621,8 +755,8 @@ class DatadogSingleSignOnResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: - :type properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + :ivar properties: + :vartype properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -648,6 +782,10 @@ def __init__( properties: Optional["DatadogSingleSignOnProperties"] = None, **kwargs ): + """ + :keyword properties: + :paramtype properties: ~microsoft_datadog_client.models.DatadogSingleSignOnProperties + """ super(DatadogSingleSignOnResource, self).__init__(**kwargs) self.id = None self.name = None @@ -659,10 +797,10 @@ def __init__( class DatadogSingleSignOnResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -677,6 +815,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(DatadogSingleSignOnResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -707,6 +851,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -749,6 +895,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -760,8 +908,8 @@ def __init__( class ErrorResponse(msrest.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.). - :param error: The error object. - :type error: ~microsoft_datadog_client.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~microsoft_datadog_client.models.ErrorDetail """ _attribute_map = { @@ -774,6 +922,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~microsoft_datadog_client.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -781,13 +933,13 @@ def __init__( class FilteringTag(msrest.serialization.Model): """The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. - :param name: The name (also known as the key) of the tag. - :type name: str - :param value: The value of the tag. - :type value: str - :param action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + :ivar name: The name (also known as the key) of the tag. + :vartype name: str + :ivar value: The value of the tag. + :vartype value: str + :ivar action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. Possible values include: "Include", "Exclude". - :type action: str or ~microsoft_datadog_client.models.TagAction + :vartype action: str or ~microsoft_datadog_client.models.TagAction """ _attribute_map = { @@ -804,6 +956,15 @@ def __init__( action: Optional[Union[str, "TagAction"]] = None, **kwargs ): + """ + :keyword name: The name (also known as the key) of the tag. + :paramtype name: str + :keyword value: The value of the tag. + :paramtype value: str + :keyword action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :paramtype action: str or ~microsoft_datadog_client.models.TagAction + """ super(FilteringTag, self).__init__(**kwargs) self.name = name self.value = value @@ -819,8 +980,8 @@ class IdentityProperties(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". - :type type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + :ivar type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :vartype type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes """ _validation = { @@ -840,6 +1001,10 @@ def __init__( type: Optional[Union[str, "ManagedIdentityTypes"]] = None, **kwargs ): + """ + :keyword type: Identity type. Possible values include: "SystemAssigned", "UserAssigned". + :paramtype type: str or ~microsoft_datadog_client.models.ManagedIdentityTypes + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -849,8 +1014,8 @@ def __init__( class LinkedResource(msrest.serialization.Model): """The definition of a linked resource. - :param id: The ARM id of the linked resource. - :type id: str + :ivar id: The ARM id of the linked resource. + :vartype id: str """ _attribute_map = { @@ -863,6 +1028,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM id of the linked resource. + :paramtype id: str + """ super(LinkedResource, self).__init__(**kwargs) self.id = id @@ -870,10 +1039,10 @@ def __init__( class LinkedResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.LinkedResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.LinkedResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -888,6 +1057,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.LinkedResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(LinkedResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -896,19 +1071,19 @@ def __init__( class LogRules(msrest.serialization.Model): """Set of rules for sending logs for the Monitor resource. - :param send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. - :type send_aad_logs: bool - :param send_subscription_logs: Flag specifying if Azure subscription logs should be sent for - the Monitor resource. - :type send_subscription_logs: bool - :param send_resource_logs: Flag specifying if Azure resource logs should be sent for the + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :vartype send_aad_logs: bool + :ivar send_subscription_logs: Flag specifying if Azure subscription logs should be sent for the Monitor resource. - :type send_resource_logs: bool - :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + :vartype send_subscription_logs: bool + :ivar send_resource_logs: Flag specifying if Azure resource logs should be sent for the Monitor + resource. + :vartype send_resource_logs: bool + :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :vartype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] """ _attribute_map = { @@ -927,6 +1102,21 @@ def __init__( filtering_tags: Optional[List["FilteringTag"]] = None, **kwargs ): + """ + :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + :paramtype send_aad_logs: bool + :keyword send_subscription_logs: Flag specifying if Azure subscription logs should be sent for + the Monitor resource. + :paramtype send_subscription_logs: bool + :keyword send_resource_logs: Flag specifying if Azure resource logs should be sent for the + Monitor resource. + :paramtype send_resource_logs: bool + :keyword filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only + Exclude action is specified, the rules will apply to the list of all available resources. If + Include actions are specified, the rules will only include resources with the associated tags. + :paramtype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ super(LogRules, self).__init__(**kwargs) self.send_aad_logs = send_aad_logs self.send_subscription_logs = send_subscription_logs @@ -937,11 +1127,11 @@ def __init__( class MetricRules(msrest.serialization.Model): """Set of rules for sending metrics for the Monitor resource. - :param filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + :ivar 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 list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - :type filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + :vartype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] """ _attribute_map = { @@ -954,6 +1144,13 @@ def __init__( filtering_tags: Optional[List["FilteringTag"]] = None, **kwargs ): + """ + :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 + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :paramtype filtering_tags: list[~microsoft_datadog_client.models.FilteringTag] + """ super(MetricRules, self).__init__(**kwargs) self.filtering_tags = filtering_tags @@ -961,18 +1158,18 @@ def __init__( class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Datadog monitor resource. - :param id: The ARM id of the resource. - :type id: str - :param sending_metrics: Flag indicating if resource is sending metrics to Datadog. - :type sending_metrics: bool - :param reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_metrics: Flag indicating if resource is sending metrics to Datadog. + :vartype sending_metrics: bool + :ivar reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is not sending). - :type reason_for_metrics_status: str - :param sending_logs: Flag indicating if resource is sending logs to Datadog. - :type sending_logs: bool - :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + :vartype reason_for_metrics_status: str + :ivar sending_logs: Flag indicating if resource is sending logs to Datadog. + :vartype sending_logs: bool + :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not sending). - :type reason_for_logs_status: str + :vartype reason_for_logs_status: str """ _attribute_map = { @@ -993,6 +1190,20 @@ def __init__( reason_for_logs_status: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM id of the resource. + :paramtype id: str + :keyword sending_metrics: Flag indicating if resource is sending metrics to Datadog. + :paramtype sending_metrics: bool + :keyword reason_for_metrics_status: Reason for why the resource is sending metrics (or why it + is not sending). + :paramtype reason_for_metrics_status: str + :keyword sending_logs: Flag indicating if resource is sending logs to Datadog. + :paramtype sending_logs: bool + :keyword reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :paramtype reason_for_logs_status: str + """ super(MonitoredResource, self).__init__(**kwargs) self.id = id self.sending_metrics = sending_metrics @@ -1004,10 +1215,10 @@ def __init__( class MonitoredResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.MonitoredResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.MonitoredResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -1022,6 +1233,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.MonitoredResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(MonitoredResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1038,8 +1255,8 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param properties: Definition of the properties for a TagRules resource. - :type properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + :ivar properties: Definition of the properties for a TagRules resource. + :vartype properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~microsoft_datadog_client.models.SystemData """ @@ -1065,6 +1282,10 @@ def __init__( properties: Optional["MonitoringTagRulesProperties"] = None, **kwargs ): + """ + :keyword properties: Definition of the properties for a TagRules resource. + :paramtype properties: ~microsoft_datadog_client.models.MonitoringTagRulesProperties + """ super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None @@ -1076,10 +1297,10 @@ def __init__( class MonitoringTagRulesListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~microsoft_datadog_client.models.MonitoringTagRules] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~microsoft_datadog_client.models.MonitoringTagRules] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -1094,6 +1315,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~microsoft_datadog_client.models.MonitoringTagRules] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(MonitoringTagRulesListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1104,13 +1331,13 @@ class MonitoringTagRulesProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param log_rules: Set of rules for sending logs for the Monitor resource. - :type log_rules: ~microsoft_datadog_client.models.LogRules - :param metric_rules: Set of rules for sending metrics for the Monitor resource. - :type metric_rules: ~microsoft_datadog_client.models.MetricRules + :ivar log_rules: Set of rules for sending logs for the Monitor resource. + :vartype log_rules: ~microsoft_datadog_client.models.LogRules + :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. + :vartype metric_rules: ~microsoft_datadog_client.models.MetricRules """ _validation = { @@ -1130,6 +1357,12 @@ def __init__( metric_rules: Optional["MetricRules"] = None, **kwargs ): + """ + :keyword log_rules: Set of rules for sending logs for the Monitor resource. + :paramtype log_rules: ~microsoft_datadog_client.models.LogRules + :keyword metric_rules: Set of rules for sending metrics for the Monitor resource. + :paramtype metric_rules: ~microsoft_datadog_client.models.MetricRules + """ super(MonitoringTagRulesProperties, self).__init__(**kwargs) self.provisioning_state = None self.log_rules = log_rules @@ -1141,23 +1374,23 @@ class MonitorProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", + :ivar provisioning_state: Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". :vartype provisioning_state: str or ~microsoft_datadog_client.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus :ivar marketplace_subscription_status: Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. Possible values include: "Provisioning", "Active", "Suspended", "Unsubscribed". :vartype marketplace_subscription_status: str or ~microsoft_datadog_client.models.MarketplaceSubscriptionStatus - :param datadog_organization_properties: Datadog organization properties. - :type datadog_organization_properties: + :ivar datadog_organization_properties: Datadog organization properties. + :vartype datadog_organization_properties: ~microsoft_datadog_client.models.DatadogOrganizationProperties - :param user_info: User info. - :type user_info: ~microsoft_datadog_client.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :ivar user_info: User info. + :vartype user_info: ~microsoft_datadog_client.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or ~microsoft_datadog_client.models.LiftrResourceCategories :ivar liftr_resource_preference: The priority of the resource. @@ -1189,6 +1422,16 @@ def __init__( user_info: Optional["UserInfo"] = None, **kwargs ): + """ + :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :keyword datadog_organization_properties: Datadog organization properties. + :paramtype datadog_organization_properties: + ~microsoft_datadog_client.models.DatadogOrganizationProperties + :keyword user_info: User info. + :paramtype user_info: ~microsoft_datadog_client.models.UserInfo + """ super(MonitorProperties, self).__init__(**kwargs) self.provisioning_state = None self.monitoring_status = monitoring_status @@ -1202,9 +1445,9 @@ def __init__( class MonitorUpdateProperties(msrest.serialization.Model): """The set of properties that can be update in a PATCH request to a monitor resource. - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + :vartype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus """ _attribute_map = { @@ -1217,6 +1460,11 @@ def __init__( monitoring_status: Optional[Union[str, "MonitoringStatus"]] = "Enabled", **kwargs ): + """ + :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype monitoring_status: str or ~microsoft_datadog_client.models.MonitoringStatus + """ super(MonitorUpdateProperties, self).__init__(**kwargs) self.monitoring_status = monitoring_status @@ -1224,14 +1472,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: Service provider, i.e., Microsoft.Datadog. - :type provider: str - :param resource: Type on which the operation is performed, e.g., 'monitors'. - :type resource: str - :param operation: Operation type, e.g., read, write, delete, etc. - :type operation: str - :param description: Description of the operation, e.g., 'Write monitors'. - :type description: str + :ivar provider: Service provider, i.e., Microsoft.Datadog. + :vartype provider: str + :ivar resource: Type on which the operation is performed, e.g., 'monitors'. + :vartype resource: str + :ivar operation: Operation type, e.g., read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation, e.g., 'Write monitors'. + :vartype description: str """ _attribute_map = { @@ -1250,6 +1498,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider, i.e., Microsoft.Datadog. + :paramtype provider: str + :keyword resource: Type on which the operation is performed, e.g., 'monitors'. + :paramtype resource: str + :keyword operation: Operation type, e.g., read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation, e.g., 'Write monitors'. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1260,10 +1518,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of GET request to list the Microsoft.Datadog operations. - :param value: List of operations supported by the Microsoft.Datadog provider. - :type value: list[~microsoft_datadog_client.models.OperationResult] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: List of operations supported by the Microsoft.Datadog provider. + :vartype value: list[~microsoft_datadog_client.models.OperationResult] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -1278,6 +1536,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of operations supported by the Microsoft.Datadog provider. + :paramtype value: list[~microsoft_datadog_client.models.OperationResult] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1286,12 +1550,12 @@ def __init__( class OperationResult(msrest.serialization.Model): """A Microsoft.Datadog REST API operation. - :param name: Operation name, i.e., {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~microsoft_datadog_client.models.OperationDisplay - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool + :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~microsoft_datadog_client.models.OperationDisplay + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool """ _attribute_map = { @@ -1308,6 +1572,14 @@ def __init__( is_data_action: Optional[bool] = None, **kwargs ): + """ + :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~microsoft_datadog_client.models.OperationDisplay + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ super(OperationResult, self).__init__(**kwargs) self.name = name self.display = display @@ -1319,8 +1591,8 @@ class ResourceSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the SKU. - :type name: str + :ivar name: Required. Name of the SKU. + :vartype name: str """ _validation = { @@ -1337,6 +1609,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name of the SKU. + :paramtype name: str + """ super(ResourceSku, self).__init__(**kwargs) self.name = name @@ -1344,20 +1620,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~microsoft_datadog_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1380,6 +1656,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~microsoft_datadog_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1392,12 +1684,12 @@ def __init__( class UserInfo(msrest.serialization.Model): """User info. - :param name: Name of the user. - :type name: str - :param email_address: Email of the user used by Datadog for contacting them if needed. - :type email_address: str - :param phone_number: Phone number of the user used by Datadog for contacting them if needed. - :type phone_number: str + :ivar name: Name of the user. + :vartype name: str + :ivar email_address: Email of the user used by Datadog for contacting them if needed. + :vartype email_address: str + :ivar phone_number: Phone number of the user used by Datadog for contacting them if needed. + :vartype phone_number: str """ _validation = { @@ -1420,6 +1712,14 @@ def __init__( phone_number: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the user. + :paramtype name: str + :keyword email_address: Email of the user used by Datadog for contacting them if needed. + :paramtype email_address: str + :keyword phone_number: Phone number of the user used by Datadog for contacting them if needed. + :paramtype phone_number: str + """ super(UserInfo, self).__init__(**kwargs) self.name = name self.email_address = email_address diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_api_keys_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_api_keys_operations.py deleted file mode 100644 index 0952de16086c..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_api_keys_operations.py +++ /dev/null @@ -1,259 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApiKeysOperations(object): - """ApiKeysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatadogApiKeyListResponse"] - """List the api keys for a given monitor resource. - - List the api keys for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listApiKeys'} # type: ignore - - def get_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DatadogApiKey" - """Get the default api key. - - Get the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogApiKey, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogApiKey - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKey"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogApiKey', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore - - def set_default_key( - self, - resource_group_name, # type: str - monitor_name, # type: str - body=None, # type: Optional["_models.DatadogApiKey"] - **kwargs # type: Any - ): - # type: (...) -> None - """Set the default api key. - - Set the default api key. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :param body: - :type body: ~microsoft_datadog_client.models.DatadogApiKey - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if body is not None: - body_content = self._serialize.body(body, 'DatadogApiKey') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_hosts_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_hosts_operations.py deleted file mode 100644 index 91130eee8f03..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_hosts_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class HostsOperations(object): - """HostsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatadogHostListResponse"] - """List the hosts for a given monitor resource. - - List the hosts for a given monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 DatadogHostListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogHostListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listHosts'} # type: ignore diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_linked_resources_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_linked_resources_operations.py deleted file mode 100644 index c5e204dd6b72..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_linked_resources_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class LinkedResourcesOperations(object): - """LinkedResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LinkedResourceListResponse"] - """List all Azure resources associated to the same Datadog organization as the target resource. - - List all Azure resources associated to the same Datadog organization as the target resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listLinkedResources'} # type: ignore 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 50d73fcc8315..d0d96a840a0d 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 @@ -5,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class MarketplaceAgreementsOperations(object): """MarketplaceAgreementsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -55,8 +132,10 @@ def list( List Datadog marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] + :return: An iterator like instance of either DatadogAgreementResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogAgreementResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogAgreementResourceListResponse"] @@ -64,34 +143,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogAgreementResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,17 +178,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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/agreements'} # type: ignore + @distributed_trace def create_or_update( self, body=None, # type: Optional["_models.DatadogAgreementResource"] @@ -137,39 +213,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogAgreementResource') + _json = self._serialize.body(body, 'DatadogAgreementResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogAgreementResource', pipeline_response) @@ -178,4 +244,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default'} # type: ignore + diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_resources_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_resources_operations.py deleted file mode 100644 index 034e166eb936..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_monitored_resources_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class MonitoredResourcesOperations(object): - """MonitoredResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoredResourceListResponse"] - """List the resources currently being monitored by the Datadog monitor resource. - - List the resources currently being monitored by the Datadog monitor resource. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :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 MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - 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) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}/listMonitoredResources'} # type: ignore 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 2a64606fef1a..258524d91955 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 @@ -5,26 +5,508 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_api_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_default_key_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_set_default_key_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_hosts_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_linked_resources_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_monitored_resources_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors') + 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), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_set_password_link_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class MonitorsOperations(object): """MonitorsOperations operations. @@ -47,6 +529,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_api_keys( self, resource_group_name, # type: str @@ -63,8 +546,10 @@ def list_api_keys( :param monitor_name: Monitor resource name. :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 DatadogApiKeyListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] + :return: An iterator like instance of either DatadogApiKeyListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogApiKeyListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogApiKeyListResponse"] @@ -72,36 +557,33 @@ def list_api_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_api_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_api_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_api_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_api_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogApiKeyListResponse', pipeline_response) + deserialized = self._deserialize("DatadogApiKeyListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +596,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys'} # type: ignore + @distributed_trace def get_default_key( self, resource_group_name, # type: str @@ -150,33 +634,23 @@ def get_default_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_default_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.get_default_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogApiKey', pipeline_response) @@ -185,8 +659,11 @@ def get_default_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey'} # type: ignore + + @distributed_trace def set_default_key( self, resource_group_name, # type: str @@ -215,41 +692,31 @@ def set_default_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set_default_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogApiKey') + _json = self._serialize.body(body, 'DatadogApiKey') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_set_default_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self.set_default_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -257,6 +724,8 @@ def set_default_key( set_default_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey'} # type: ignore + + @distributed_trace def list_hosts( self, resource_group_name, # type: str @@ -273,7 +742,8 @@ def list_hosts( :param monitor_name: Monitor resource name. :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 DatadogHostListResponse or the result of cls(response) + :return: An iterator like instance of either DatadogHostListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogHostListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -282,36 +752,33 @@ def list_hosts( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_hosts.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_hosts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogHostListResponse', pipeline_response) + deserialized = self._deserialize("DatadogHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -324,17 +791,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts'} # type: ignore + @distributed_trace def list_linked_resources( self, resource_group_name, # type: str @@ -351,8 +820,10 @@ def list_linked_resources( :param monitor_name: Monitor resource name. :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 LinkedResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] + :return: An iterator like instance of either LinkedResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.LinkedResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedResourceListResponse"] @@ -360,36 +831,33 @@ def list_linked_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_linked_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_linked_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_linked_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_linked_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedResourceListResponse', pipeline_response) + deserialized = self._deserialize("LinkedResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -402,17 +870,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_linked_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources'} # type: ignore + @distributed_trace def list_monitored_resources( self, resource_group_name, # type: str @@ -429,8 +899,10 @@ def list_monitored_resources( :param monitor_name: Monitor resource name. :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 MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] @@ -438,36 +910,33 @@ def list_monitored_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_monitored_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list_monitored_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoredResourceListResponse', pipeline_response) + deserialized = self._deserialize("MonitoredResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -480,17 +949,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_monitored_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources'} # type: ignore + @distributed_trace def list( self, **kwargs # type: Any @@ -501,8 +972,10 @@ def list( List all monitors under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResourceListResponse"] @@ -510,34 +983,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -550,17 +1018,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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/monitors'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -574,8 +1044,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] + :return: An iterator like instance of either DatadogMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResourceListResponse"] @@ -583,35 +1055,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -624,17 +1092,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -660,33 +1130,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -695,8 +1155,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + def _create_initial( self, resource_group_name, # type: str @@ -710,42 +1172,31 @@ def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogMonitorResource') + _json = self._serialize.body(body, 'DatadogMonitorResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -757,8 +1208,11 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace def begin_create( self, resource_group_name, # type: str @@ -779,15 +1233,19 @@ def begin_create( :type body: ~microsoft_datadog_client.models.DatadogMonitorResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -799,27 +1257,21 @@ def begin_create( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -831,6 +1283,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore def _update_initial( @@ -846,42 +1299,31 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') + _json = self._serialize.body(body, 'DatadogMonitorResourceUpdateParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) @@ -893,8 +1335,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -915,15 +1360,19 @@ def begin_update( :type body: ~microsoft_datadog_client.models.DatadogMonitorResourceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DatadogMonitorResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -935,27 +1384,21 @@ def begin_update( resource_group_name=resource_group_name, monitor_name=monitor_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogMonitorResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -967,6 +1410,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore def _delete_initial( @@ -981,40 +1425,31 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -1032,15 +1467,17 @@ def begin_delete( :type monitor_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1054,21 +1491,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1080,8 +1510,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}'} # type: ignore + @distributed_trace def refresh_set_password_link( self, resource_group_name, # type: str @@ -1107,33 +1539,23 @@ def refresh_set_password_link( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.refresh_set_password_link.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_set_password_link_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.refresh_set_password_link.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) @@ -1142,4 +1564,6 @@ def refresh_set_password_link( return cls(pipeline_response, deserialized, {}) return deserialized + refresh_set_password_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore + 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 6379d62b7d81..5a9cfc768597 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 @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Datadog/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -64,30 +99,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,12 +132,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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 ) diff --git a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_refresh_set_password_operations.py b/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_refresh_set_password_operations.py deleted file mode 100644 index 1cb402e2db32..000000000000 --- a/sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/operations/_refresh_set_password_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class RefreshSetPasswordOperations(object): - """RefreshSetPasswordOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~microsoft_datadog_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DatadogSetPasswordLink" - """Refresh the set password link and return a latest one. - - Refresh the set password link and return a latest one. - - :param resource_group_name: The name of the resource group to which the Datadog resource - belongs. - :type resource_group_name: str - :param monitor_name: Monitor resource name. - :type monitor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatadogSetPasswordLink, or the result of cls(response) - :rtype: ~microsoft_datadog_client.models.DatadogSetPasswordLink - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSetPasswordLink"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-02-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatadogSetPasswordLink', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink'} # type: ignore 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 81ba8c479ab2..290d75e08836 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 @@ -5,26 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + configuration_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + configuration_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SingleSignOnConfigurationsOperations(object): """SingleSignOnConfigurationsOperations operations. @@ -47,6 +171,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -63,8 +188,10 @@ def list( :param monitor_name: Monitor resource name. :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 DatadogSingleSignOnResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogSingleSignOnResourceListResponse] + :return: An iterator like instance of either DatadogSingleSignOnResourceListResponse or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.DatadogSingleSignOnResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSingleSignOnResourceListResponse"] @@ -72,36 +199,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatadogSingleSignOnResourceListResponse', pipeline_response) + deserialized = self._deserialize("DatadogSingleSignOnResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,12 +238,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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 ) @@ -139,43 +264,32 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'DatadogSingleSignOnResource') + _json = self._serialize.body(body, 'DatadogSingleSignOnResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) @@ -187,8 +301,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -212,15 +329,20 @@ def begin_create_or_update( :type body: ~microsoft_datadog_client.models.DatadogSingleSignOnResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DatadogSingleSignOnResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogSingleSignOnResource] - :raises ~azure.core.exceptions.HttpResponseError: + :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 DatadogSingleSignOnResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~microsoft_datadog_client.models.DatadogSingleSignOnResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatadogSingleSignOnResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -233,28 +355,21 @@ def begin_create_or_update( monitor_name=monitor_name, configuration_name=configuration_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -266,8 +381,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -296,34 +413,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatadogSingleSignOnResource', pipeline_response) @@ -332,4 +439,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}'} # type: ignore + 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 22b4006d5ce6..e7e99ac6cc57 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 @@ -5,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules') + 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 = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}') + 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'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + monitor_name, # type: str + rule_set_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}') + 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'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TagRulesOperations(object): """TagRulesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -61,8 +186,10 @@ def list( :param monitor_name: Monitor resource name. :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 MonitoringTagRulesListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoringTagRulesListResponse] + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~microsoft_datadog_client.models.MonitoringTagRulesListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringTagRulesListResponse"] @@ -70,36 +197,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MonitoringTagRulesListResponse', pipeline_response) + deserialized = self._deserialize("MonitoringTagRulesListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +236,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/tagRules'} # type: ignore + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -154,42 +280,32 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'MonitoringTagRules') + _json = self._serialize.body(body, 'MonitoringTagRules') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -198,8 +314,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -228,34 +347,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -264,4 +373,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore +