From 4fa4b20c5063c2cf768bd1dcb82e98db87ba9ec4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 07:35:14 +0000 Subject: [PATCH] CodeGen from PR 16902 in Azure/azure-rest-api-specs Track2 modify readme.go.md 4 (#16902) * Track2 modify readme.go.md 4 * devops --- sdk/elastic/azure-mgmt-elastic/_meta.json | 10 +- .../azure/mgmt/elastic/__init__.py | 9 +- .../azure/mgmt/elastic/_configuration.py | 19 +- .../azure/mgmt/elastic/_metadata.json | 21 +- .../azure/mgmt/elastic/_microsoft_elastic.py | 111 +-- .../azure/mgmt/elastic/_patch.py | 31 + .../azure/mgmt/elastic/_vendor.py | 27 + .../azure/mgmt/elastic/_version.py | 2 +- .../azure/mgmt/elastic/aio/__init__.py | 5 + .../azure/mgmt/elastic/aio/_configuration.py | 6 +- .../mgmt/elastic/aio/_microsoft_elastic.py | 99 +- .../azure/mgmt/elastic/aio/_patch.py | 31 + .../operations/_deployment_info_operations.py | 44 +- .../_monitored_resources_operations.py | 64 +- .../aio/operations/_monitors_operations.py | 318 +++--- .../elastic/aio/operations/_operations.py | 44 +- .../aio/operations/_tag_rules_operations.py | 204 ++-- .../operations/_vm_collection_operations.py | 52 +- .../aio/operations/_vm_host_operations.py | 58 +- .../operations/_vm_ingestion_operations.py | 41 +- .../azure/mgmt/elastic/models/__init__.py | 90 +- .../models/_microsoft_elastic_enums.py | 37 +- .../azure/mgmt/elastic/models/_models.py | 941 ------------------ .../azure/mgmt/elastic/models/_models_py3.py | 499 +++++++--- .../operations/_deployment_info_operations.py | 100 +- .../_monitored_resources_operations.py | 116 ++- .../operations/_monitors_operations.py | 624 +++++++----- .../mgmt/elastic/operations/_operations.py | 85 +- .../operations/_tag_rules_operations.py | 423 +++++--- .../operations/_vm_collection_operations.py | 120 ++- .../elastic/operations/_vm_host_operations.py | 113 ++- .../operations/_vm_ingestion_operations.py | 97 +- 32 files changed, 2096 insertions(+), 2345 deletions(-) create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py create mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py delete mode 100644 sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py diff --git a/sdk/elastic/azure-mgmt-elastic/_meta.json b/sdk/elastic/azure-mgmt-elastic/_meta.json index 517006ca68469..def9a1428ba31 100644 --- a/sdk/elastic/azure-mgmt-elastic/_meta.json +++ b/sdk/elastic/azure-mgmt-elastic/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "969711ae6f1a8ede40dde2dd40dee780344cdc2e", + "commit": "cea6492a1e41b3f3b4f8b4f69bdcc10431e79c0e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/elastic/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.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/elastic/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/elastic/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py index 4e04609bc42c1..63f68d2953e75 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['MicrosoftElastic'] -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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py index 2b71d732abd5a..1c8642f852812 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING 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 - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class MicrosoftElasticConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(MicrosoftElasticConfiguration, 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(MicrosoftElasticConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_metadata.json b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_metadata.json index 333fd3743f28b..c244413f13e94 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_metadata.json +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_metadata.json @@ -5,13 +5,13 @@ "name": "MicrosoftElastic", "filename": "_microsoft_elastic", "description": "MicrosoftElastic.", - "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\": [\"MicrosoftElasticConfiguration\"]}}, \"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\": [\"MicrosoftElasticConfiguration\"]}}, \"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\": [\"MicrosoftElasticConfiguration\"]}}, \"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\": [\"MicrosoftElasticConfiguration\"]}}, \"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": { "operations": "Operations", diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py index 1b77371ed5a3f..ecbc720ad5e89 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_microsoft_elastic.py @@ -6,31 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import MicrosoftElasticConfiguration +from .operations import DeploymentInfoOperations, MonitoredResourcesOperations, MonitorsOperations, Operations, TagRulesOperations, VMCollectionOperations, VMHostOperations, VMIngestionOperations + 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 MicrosoftElasticConfiguration -from .operations import Operations -from .operations import MonitorsOperations -from .operations import MonitoredResourcesOperations -from .operations import DeploymentInfoOperations -from .operations import TagRulesOperations -from .operations import VMHostOperations -from .operations import VMIngestionOperations -from .operations import VMCollectionOperations -from . import models - -class MicrosoftElastic(object): +class MicrosoftElastic: """MicrosoftElastic. :ivar operations: Operations operations @@ -51,64 +42,64 @@ class MicrosoftElastic(object): :vartype vm_collection: azure.mgmt.elastic.operations.VMCollectionOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftElasticConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = MicrosoftElasticConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitored_resources = MonitoredResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployment_info = DeploymentInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_collection = VMCollectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resources = MonitoredResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployment_info = DeploymentInfoOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_host = VMHostOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_ingestion = VMIngestionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_collection = VMCollectionOperations( - 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: Any + ) -> 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'), - } - 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py index c47f66669f1bf..e5754a47ce68f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py index 307ea00d41d8c..cf4ae0358a8d0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/__init__.py @@ -8,3 +8,8 @@ from ._microsoft_elastic import MicrosoftElastic __all__ = ['MicrosoftElastic'] + +# `._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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py index d96b8773a9679..6155607fd8485 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_configuration.py @@ -10,7 +10,7 @@ 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 @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(MicrosoftElasticConfiguration, 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(MicrosoftElasticConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py index a126083ac1928..0182c8f67e221 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_microsoft_elastic.py @@ -6,29 +6,22 @@ # 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 MicrosoftElasticConfiguration +from .operations import DeploymentInfoOperations, MonitoredResourcesOperations, MonitorsOperations, Operations, TagRulesOperations, VMCollectionOperations, VMHostOperations, VMIngestionOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MicrosoftElasticConfiguration -from .operations import Operations -from .operations import MonitorsOperations -from .operations import MonitoredResourcesOperations -from .operations import DeploymentInfoOperations -from .operations import TagRulesOperations -from .operations import VMHostOperations -from .operations import VMIngestionOperations -from .operations import VMCollectionOperations -from .. import models - - -class MicrosoftElastic(object): +class MicrosoftElastic: """MicrosoftElastic. :ivar operations: Operations operations @@ -49,62 +42,64 @@ class MicrosoftElastic(object): :vartype vm_collection: azure.mgmt.elastic.aio.operations.VMCollectionOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :type subscription_id: str - :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 = MicrosoftElasticConfiguration(credential, subscription_id, **kwargs) + self._config = MicrosoftElasticConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitored_resources = MonitoredResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployment_info = DeploymentInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_host = VMHostOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_ingestion = VMIngestionOperations(self._client, self._config, self._serialize, self._deserialize) + self.vm_collection = VMCollectionOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.monitors = MonitorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitored_resources = MonitoredResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployment_info = DeploymentInfoOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_rules = TagRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_host = VMHostOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_ingestion = VMIngestionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vm_collection = VMCollectionOperations( - 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'), - } - 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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py index 3245aee4fcf97..cba6920d0b7ce 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_deployment_info_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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._deployment_info_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +44,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, monitor_name: str, **kwargs: Any ) -> "_models.DeploymentInfoResponse": - """Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + """Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor + resource. Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. @@ -66,33 +72,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # 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 = 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) - # 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.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentInfoResponse', pipeline_response) @@ -101,4 +97,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo'} # type: ignore + diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py index d5b72855a2f57..73aed90ccc214 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitored_resources_operations.py @@ -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._monitored_resources_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, resource_group_name: str, @@ -57,8 +63,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 MonitoredResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredResourceListResponse] + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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) + + 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('MonitoredResourceListResponse', pipeline_response) + deserialized = self._deserialize("MonitoredResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,12 +113,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py index e42b399e2fd37..683d206071f20 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_monitors_operations.py @@ -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_request, build_list_by_resource_group_request, build_list_request, build_update_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, **kwargs: Any @@ -52,8 +58,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 ElasticMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] + :return: An iterator like instance of either ElasticMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ElasticMonitorResourceListResponse"] @@ -61,34 +69,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - } - 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('ElasticMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("ElasticMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +104,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -125,8 +130,10 @@ def list_by_resource_group( belongs. :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 ElasticMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] + :return: An iterator like instance of either ElasticMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ElasticMonitorResourceListResponse"] @@ -134,35 +141,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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_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('ElasticMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("ElasticMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -175,17 +178,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -211,33 +216,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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 = 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ElasticMonitorResource', pipeline_response) @@ -246,8 +241,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -260,42 +257,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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') + 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, 'ElasticMonitorResource') + _json = self._serialize.body(body, 'ElasticMonitorResource') 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.ResourceProviderDefaultErrorResponse, 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('ElasticMonitorResource', pipeline_response) @@ -307,8 +293,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -329,15 +318,19 @@ async def begin_create( :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource :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 ElasticMonitorResource 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 AsyncLROPoller that returns either ElasticMonitorResource or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :raises ~azure.core.exceptions.HttpResponseError: + :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.ElasticMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -349,27 +342,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('ElasticMonitorResource', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -381,8 +368,10 @@ 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.Elastic/monitors/{monitorName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -411,41 +400,31 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + 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, 'ElasticMonitorResourceUpdateParameters') + _json = self._serialize.body(body, 'ElasticMonitorResourceUpdateParameters') 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( + 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.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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ElasticMonitorResource', pipeline_response) @@ -454,8 +433,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -467,40 +448,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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 = 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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -518,15 +490,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', @@ -540,21 +514,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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -566,4 +533,5 @@ 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.Elastic/monitors/{monitorName}'} # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py index a505ab3fd406b..027b5a76d4110 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_operations.py @@ -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 @@ -59,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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 +98,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py index 60193a1fb7f56..241660adb1bf3 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_tag_rules_operations.py @@ -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._tag_rules_operations import build_create_or_update_request, build_delete_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, @@ -59,8 +65,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[~azure.mgmt.elastic.models.MonitoringTagRulesListResponse] + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elastic.models.MonitoringTagRulesListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringTagRulesListResponse"] @@ -68,36 +76,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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.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) @@ -110,17 +115,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -152,42 +159,32 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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['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, '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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -196,8 +193,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -226,34 +226,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -262,8 +252,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -276,41 +268,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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_delete_request_initial( + 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._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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -331,15 +314,17 @@ async def begin_delete( :type rule_set_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', @@ -354,22 +339,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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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: @@ -381,4 +358,5 @@ 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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py index 1ff239976690d..55812769510fc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_collection_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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._vm_collection_operations import build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def update( self, resource_group_name: str, @@ -68,44 +73,35 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + 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, 'VMCollectionUpdate') + _json = self._serialize.body(body, 'VMCollectionUpdate') 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_update_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.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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate'} # type: ignore + diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py index 8651d677ba863..090de99046e7f 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_host_operations.py @@ -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._vm_host_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, resource_group_name: str, @@ -66,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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) + + 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('VMHostListResponse', pipeline_response) + deserialized = self._deserialize("VMHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,12 +111,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py index 02558fab304da..64c5e467881a8 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/aio/operations/_vm_ingestion_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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._vm_ingestion_operations import build_details_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def details( self, resource_group_name: str, @@ -65,33 +70,23 @@ async def details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.details.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 = build_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.details.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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMIngestionDetailsResponse', pipeline_response) @@ -100,4 +95,6 @@ async def details( return cls(pipeline_response, deserialized, {}) return deserialized + details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails'} # type: ignore + diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py index cc82ec2a77a68..f1011a5963695 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/__init__.py @@ -6,66 +6,36 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CompanyInfo - from ._models_py3 import DeploymentInfoResponse - from ._models_py3 import ElasticCloudDeployment - from ._models_py3 import ElasticCloudUser - from ._models_py3 import ElasticMonitorResource - from ._models_py3 import ElasticMonitorResourceListResponse - from ._models_py3 import ElasticMonitorResourceUpdateParameters - from ._models_py3 import ElasticProperties - from ._models_py3 import ErrorResponseBody - from ._models_py3 import FilteringTag - from ._models_py3 import IdentityProperties - from ._models_py3 import LogRules - from ._models_py3 import MonitorProperties - from ._models_py3 import MonitoredResource - from ._models_py3 import MonitoredResourceListResponse - from ._models_py3 import MonitoringTagRules - from ._models_py3 import MonitoringTagRulesListResponse - from ._models_py3 import MonitoringTagRulesProperties - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import ResourceProviderDefaultErrorResponse - from ._models_py3 import ResourceSku - from ._models_py3 import SystemData - from ._models_py3 import UserInfo - from ._models_py3 import VMCollectionUpdate - from ._models_py3 import VMHostListResponse - from ._models_py3 import VMIngestionDetailsResponse - from ._models_py3 import VMResources -except (SyntaxError, ImportError): - from ._models import CompanyInfo # type: ignore - from ._models import DeploymentInfoResponse # type: ignore - from ._models import ElasticCloudDeployment # type: ignore - from ._models import ElasticCloudUser # type: ignore - from ._models import ElasticMonitorResource # type: ignore - from ._models import ElasticMonitorResourceListResponse # type: ignore - from ._models import ElasticMonitorResourceUpdateParameters # type: ignore - from ._models import ElasticProperties # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import FilteringTag # type: ignore - from ._models import IdentityProperties # type: ignore - from ._models import LogRules # type: ignore - from ._models import MonitorProperties # type: ignore - from ._models import MonitoredResource # type: ignore - from ._models import MonitoredResourceListResponse # type: ignore - from ._models import MonitoringTagRules # type: ignore - from ._models import MonitoringTagRulesListResponse # type: ignore - from ._models import MonitoringTagRulesProperties # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import ResourceProviderDefaultErrorResponse # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import SystemData # type: ignore - from ._models import UserInfo # type: ignore - from ._models import VMCollectionUpdate # type: ignore - from ._models import VMHostListResponse # type: ignore - from ._models import VMIngestionDetailsResponse # type: ignore - from ._models import VMResources # type: ignore +from ._models_py3 import CompanyInfo +from ._models_py3 import DeploymentInfoResponse +from ._models_py3 import ElasticCloudDeployment +from ._models_py3 import ElasticCloudUser +from ._models_py3 import ElasticMonitorResource +from ._models_py3 import ElasticMonitorResourceListResponse +from ._models_py3 import ElasticMonitorResourceUpdateParameters +from ._models_py3 import ElasticProperties +from ._models_py3 import ErrorResponseBody +from ._models_py3 import FilteringTag +from ._models_py3 import IdentityProperties +from ._models_py3 import LogRules +from ._models_py3 import MonitorProperties +from ._models_py3 import MonitoredResource +from ._models_py3 import MonitoredResourceListResponse +from ._models_py3 import MonitoringTagRules +from ._models_py3 import MonitoringTagRulesListResponse +from ._models_py3 import MonitoringTagRulesProperties +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import ResourceProviderDefaultErrorResponse +from ._models_py3 import ResourceSku +from ._models_py3 import SystemData +from ._models_py3 import UserInfo +from ._models_py3 import VMCollectionUpdate +from ._models_py3 import VMHostListResponse +from ._models_py3 import VMIngestionDetailsResponse +from ._models_py3 import VMResources + from ._microsoft_elastic_enums import ( CreatedByType, diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py index 23eb9781ca199..9f7c798634343 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_microsoft_elastic_enums.py @@ -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,39 +20,39 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ElasticDeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ElasticDeploymentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag specifying if the Elastic deployment status is healthy or not. """ HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" -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)): """Managed Identity types. """ SYSTEM_ASSIGNED = "SystemAssigned" -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 OperationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Operation to be performed on the given vm resource id. """ ADD = "Add" DELETE = "Delete" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of Elastic resource. """ @@ -81,14 +66,14 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" NOT_SPECIFIED = "NotSpecified" -class SendingLogs(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SendingLogs(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Flag indicating the status of the resource for sending logs operation to Elastic. """ TRUE = "True" FALSE = "False" -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/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py deleted file mode 100644 index a04ec504309ec..0000000000000 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models.py +++ /dev/null @@ -1,941 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class CompanyInfo(msrest.serialization.Model): - """Company information of the user to be passed to partners. - - :param domain: Domain of the company. - :type domain: str - :param business: Business of the company. - :type business: str - :param employees_number: Number of employees in the company. - :type employees_number: str - :param state: State of the company location. - :type state: str - :param country: Country of the company location. - :type country: str - """ - - _validation = { - 'domain': {'max_length': 250, 'min_length': 0}, - 'business': {'max_length': 50, 'min_length': 0}, - 'employees_number': {'max_length': 20, 'min_length': 0}, - 'state': {'max_length': 50, 'min_length': 0}, - 'country': {'max_length': 50, 'min_length': 0}, - } - - _attribute_map = { - 'domain': {'key': 'domain', 'type': 'str'}, - 'business': {'key': 'business', 'type': 'str'}, - 'employees_number': {'key': 'employeesNumber', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CompanyInfo, self).__init__(**kwargs) - self.domain = kwargs.get('domain', None) - self.business = kwargs.get('business', None) - self.employees_number = kwargs.get('employees_number', None) - self.state = kwargs.get('state', None) - self.country = kwargs.get('country', None) - - -class DeploymentInfoResponse(msrest.serialization.Model): - """The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The Elastic deployment status. Possible values include: "Healthy", "Unhealthy". - :vartype status: str or ~azure.mgmt.elastic.models.ElasticDeploymentStatus - :ivar version: Version of the elasticsearch in Elastic cloud deployment. - :vartype version: str - :ivar memory_capacity: RAM capacity of the elasticsearch in Elastic cloud deployment. - :vartype memory_capacity: str - :ivar disk_capacity: Disk capacity of the elasticsearch in Elastic cloud deployment. - :vartype disk_capacity: str - """ - - _validation = { - 'status': {'readonly': True}, - 'version': {'readonly': True}, - 'memory_capacity': {'readonly': True}, - 'disk_capacity': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'memory_capacity': {'key': 'memoryCapacity', 'type': 'str'}, - 'disk_capacity': {'key': 'diskCapacity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentInfoResponse, self).__init__(**kwargs) - self.status = None - self.version = None - self.memory_capacity = None - self.disk_capacity = None - - -class ElasticCloudDeployment(msrest.serialization.Model): - """Details of the user's elastic deployment associated with the monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Elastic deployment name. - :vartype name: str - :ivar deployment_id: Elastic deployment Id. - :vartype deployment_id: str - :ivar azure_subscription_id: Associated Azure subscription Id for the elastic deployment. - :vartype azure_subscription_id: str - :ivar elasticsearch_region: Region where Deployment at Elastic side took place. - :vartype elasticsearch_region: str - :ivar elasticsearch_service_url: Elasticsearch ingestion endpoint of the Elastic deployment. - :vartype elasticsearch_service_url: str - :ivar kibana_service_url: Kibana endpoint of the Elastic deployment. - :vartype kibana_service_url: str - :ivar kibana_sso_url: Kibana dashboard sso URL of the Elastic deployment. - :vartype kibana_sso_url: str - """ - - _validation = { - 'name': {'readonly': True}, - 'deployment_id': {'readonly': True}, - 'azure_subscription_id': {'readonly': True}, - 'elasticsearch_region': {'readonly': True}, - 'elasticsearch_service_url': {'readonly': True}, - 'kibana_service_url': {'readonly': True}, - 'kibana_sso_url': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'deployment_id': {'key': 'deploymentId', 'type': 'str'}, - 'azure_subscription_id': {'key': 'azureSubscriptionId', 'type': 'str'}, - 'elasticsearch_region': {'key': 'elasticsearchRegion', 'type': 'str'}, - 'elasticsearch_service_url': {'key': 'elasticsearchServiceUrl', 'type': 'str'}, - 'kibana_service_url': {'key': 'kibanaServiceUrl', 'type': 'str'}, - 'kibana_sso_url': {'key': 'kibanaSsoUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticCloudDeployment, self).__init__(**kwargs) - self.name = None - self.deployment_id = None - self.azure_subscription_id = None - self.elasticsearch_region = None - self.elasticsearch_service_url = None - self.kibana_service_url = None - self.kibana_sso_url = None - - -class ElasticCloudUser(msrest.serialization.Model): - """Details of the user's elastic account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar email_address: Email of the Elastic User Account. - :vartype email_address: str - :ivar id: User Id of the elastic account of the User. - :vartype id: str - :ivar elastic_cloud_sso_default_url: Elastic cloud default dashboard sso URL of the Elastic - user account. - :vartype elastic_cloud_sso_default_url: str - """ - - _validation = { - 'email_address': {'readonly': True}, - 'id': {'readonly': True}, - 'elastic_cloud_sso_default_url': {'readonly': True}, - } - - _attribute_map = { - 'email_address': {'key': 'emailAddress', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'elastic_cloud_sso_default_url': {'key': 'elasticCloudSsoDefaultUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticCloudUser, self).__init__(**kwargs) - self.email_address = None - self.id = None - self.elastic_cloud_sso_default_url = None - - -class ElasticMonitorResource(msrest.serialization.Model): - """Monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: ARM id of the monitor resource. - :vartype id: str - :ivar name: Name of the monitor resource. - :vartype name: str - :ivar type: The type of the monitor resource. - :vartype type: str - :param sku: SKU of the monitor resource. - :type sku: ~azure.mgmt.elastic.models.ResourceSku - :param properties: Properties of the monitor resource. - :type properties: ~azure.mgmt.elastic.models.MonitorProperties - :param identity: Identity properties of the monitor resource. - :type identity: ~azure.mgmt.elastic.models.IdentityProperties - :param tags: A set of tags. The tags of the monitor resource. - :type tags: dict[str, str] - :param location: Required. The location of the monitor resource. - :type location: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.elastic.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'properties': {'key': 'properties', 'type': 'MonitorProperties'}, - 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticMonitorResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.system_data = None - - -class ElasticMonitorResourceListResponse(msrest.serialization.Model): - """Response of a list operation. - - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ElasticMonitorResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticMonitorResourceListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ElasticMonitorResourceUpdateParameters(msrest.serialization.Model): - """Monitor resource update parameters. - - :param tags: A set of tags. elastic monitor resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticMonitorResourceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class ElasticProperties(msrest.serialization.Model): - """Elastic Resource Properties. - - :param elastic_cloud_user: Details of the user's elastic account. - :type elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser - :param elastic_cloud_deployment: Details of the elastic cloud deployment. - :type elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment - """ - - _attribute_map = { - 'elastic_cloud_user': {'key': 'elasticCloudUser', 'type': 'ElasticCloudUser'}, - 'elastic_cloud_deployment': {'key': 'elasticCloudDeployment', 'type': 'ElasticCloudDeployment'}, - } - - def __init__( - self, - **kwargs - ): - super(ElasticProperties, self).__init__(**kwargs) - self.elastic_cloud_user = kwargs.get('elastic_cloud_user', None) - self.elastic_cloud_deployment = kwargs.get('elastic_cloud_deployment', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Error response body. - - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.elastic.models.ErrorResponseBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -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. Possible values include: "Include", - "Exclude". - :type action: str or ~azure.mgmt.elastic.models.TagAction - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FilteringTag, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - self.action = kwargs.get('action', None) - - -class IdentityProperties(msrest.serialization.Model): - """Identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The identity ID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Managed identity type. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityProperties, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -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 subscription logs should be sent for the - Monitor resource. - :type send_subscription_logs: bool - :param send_activity_logs: Flag specifying if activity logs from Azure resources should be sent - for the Monitor resource. - :type send_activity_logs: bool - :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes - effect if SendActivityLogs 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[~azure.mgmt.elastic.models.FilteringTag] - """ - - _attribute_map = { - 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'bool'}, - 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'bool'}, - 'send_activity_logs': {'key': 'sendActivityLogs', 'type': 'bool'}, - 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, - } - - def __init__( - self, - **kwargs - ): - 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) - self.send_activity_logs = kwargs.get('send_activity_logs', None) - self.filtering_tags = kwargs.get('filtering_tags', None) - - -class MonitoredResource(msrest.serialization.Model): - """The properties of a resource currently being monitored by the Elastic monitor resource. - - :param id: The ARM id of the resource. - :type id: str - :param sending_logs: Flag indicating the status of the resource for sending logs operation to - Elastic. Possible values include: "True", "False". - :type sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs - :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not - sending). - :type reason_for_logs_status: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'sending_logs': {'key': 'sendingLogs', 'type': 'str'}, - 'reason_for_logs_status': {'key': 'reasonForLogsStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoredResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.sending_logs = kwargs.get('sending_logs', None) - self.reason_for_logs_status = kwargs.get('reason_for_logs_status', None) - - -class MonitoredResourceListResponse(msrest.serialization.Model): - """Response of a list operation. - - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.MonitoredResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MonitoredResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoredResourceListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MonitoringTagRules(msrest.serialization.Model): - """Capture logs and metrics of Azure resources based on ARM tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the rule set. - :vartype name: str - :ivar id: The id of the rule set. - :vartype id: str - :ivar type: The type of the rule set. - :vartype type: str - :param properties: Properties of the monitoring tag rules. - :type properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.elastic.models.SystemData - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MonitoringTagRulesProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringTagRules, self).__init__(**kwargs) - self.name = None - self.id = None - self.type = None - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class MonitoringTagRulesListResponse(msrest.serialization.Model): - """Response of a list operation. - - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.MonitoringTagRules] - :param next_link: Link to the next set of results, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MonitoringTagRules]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringTagRulesListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MonitoringTagRulesProperties(msrest.serialization.Model): - """Definition of the properties for a TagRules resource. - - :param provisioning_state: Provisioning state of the monitoring tag rules. Possible values - include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", - "Deleted", "NotSpecified". - :type provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :param log_rules: Rules for sending logs. - :type log_rules: ~azure.mgmt.elastic.models.LogRules - """ - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringTagRulesProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.log_rules = kwargs.get('log_rules', None) - - -class MonitorProperties(msrest.serialization.Model): - """Properties specific to the monitor resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param provisioning_state: Provisioning state of the monitor resource. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", - "NotSpecified". - :type provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. - Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus - :param elastic_properties: Elastic cloud properties. - :type elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties - :param user_info: User information. - :type user_info: ~azure.mgmt.elastic.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". - :vartype liftr_resource_category: str or ~azure.mgmt.elastic.models.LiftrResourceCategories - :ivar liftr_resource_preference: The priority of the resource. - :vartype liftr_resource_preference: int - """ - - _validation = { - 'liftr_resource_category': {'readonly': True}, - 'liftr_resource_preference': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, - 'elastic_properties': {'key': 'elasticProperties', 'type': 'ElasticProperties'}, - 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, - 'liftr_resource_category': {'key': 'liftrResourceCategory', 'type': 'str'}, - 'liftr_resource_preference': {'key': 'liftrResourcePreference', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitorProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.monitoring_status = kwargs.get('monitoring_status', None) - self.elastic_properties = kwargs.get('elastic_properties', None) - self.user_info = kwargs.get('user_info', None) - self.liftr_resource_category = None - self.liftr_resource_preference = None - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider, i.e., Microsoft.Elastic. - :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 - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of GET request to list the Microsoft.Elastic operations. - - :param value: List of operations supported by the Microsoft.Elastic provider. - :type value: list[~azure.mgmt.elastic.models.OperationResult] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationResult(msrest.serialization.Model): - """A Microsoft.Elastic REST API operation. - - :param name: Operation name, i.e., {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.elastic.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - - -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """RP default error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Response body of Error. - :vartype error: ~azure.mgmt.elastic.models.ErrorResponseBody - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = None - - -class ResourceSku(msrest.serialization.Model): - """Microsoft.Elastic SKU. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the SKU. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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 ~azure.mgmt.elastic.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 - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.elastic.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UserInfo(msrest.serialization.Model): - """User Information to be passed to partners. - - :param first_name: First name of the user. - :type first_name: str - :param last_name: Last name of the user. - :type last_name: str - :param company_name: Company name of the user. - :type company_name: str - :param email_address: Email of the user used by Elastic for contacting them if needed. - :type email_address: str - :param company_info: Company information of the user to be passed to partners. - :type company_info: ~azure.mgmt.elastic.models.CompanyInfo - """ - - _validation = { - 'first_name': {'max_length': 50, 'min_length': 0}, - 'last_name': {'max_length': 50, 'min_length': 0}, - 'company_name': {'max_length': 50, 'min_length': 0}, - 'email_address': {'pattern': r'^([^<>()\[\]\.,;:\s@"]+(\.[^<>()\[\]\.,;:\s@"]+)*)@(([a-zA-Z-_0-9]+\.)+[a-zA-Z]{2,})$'}, - } - - _attribute_map = { - 'first_name': {'key': 'firstName', 'type': 'str'}, - 'last_name': {'key': 'lastName', 'type': 'str'}, - 'company_name': {'key': 'companyName', 'type': 'str'}, - 'email_address': {'key': 'emailAddress', 'type': 'str'}, - 'company_info': {'key': 'companyInfo', 'type': 'CompanyInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(UserInfo, self).__init__(**kwargs) - self.first_name = kwargs.get('first_name', None) - self.last_name = kwargs.get('last_name', None) - self.company_name = kwargs.get('company_name', None) - self.email_address = kwargs.get('email_address', None) - self.company_info = kwargs.get('company_info', None) - - -class VMCollectionUpdate(msrest.serialization.Model): - """Update VM resource collection. - - :param vm_resource_id: ARM id of the VM resource. - :type vm_resource_id: str - :param operation_name: Operation to be performed for given VM. Possible values include: "Add", - "Delete". - :type operation_name: str or ~azure.mgmt.elastic.models.OperationName - """ - - _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - 'operation_name': {'key': 'operationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMCollectionUpdate, self).__init__(**kwargs) - self.vm_resource_id = kwargs.get('vm_resource_id', None) - self.operation_name = kwargs.get('operation_name', None) - - -class VMHostListResponse(msrest.serialization.Model): - """Response of a list operation. - - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.VMResources] - :param next_link: Link to the next Vm resource Id, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VMResources]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMHostListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VMIngestionDetailsResponse(msrest.serialization.Model): - """The vm ingestion details to install an agent. - - :param cloud_id: The cloudId of given Elastic monitor resource. - :type cloud_id: str - :param ingestion_key: Ingestion details to install agent on given VM. - :type ingestion_key: str - """ - - _attribute_map = { - 'cloud_id': {'key': 'cloudId', 'type': 'str'}, - 'ingestion_key': {'key': 'ingestionKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMIngestionDetailsResponse, self).__init__(**kwargs) - self.cloud_id = kwargs.get('cloud_id', None) - self.ingestion_key = kwargs.get('ingestion_key', None) - - -class VMResources(msrest.serialization.Model): - """The vm resource properties that is currently being monitored by the Elastic monitor resource. - - :param vm_resource_id: The ARM id of the VM resource. - :type vm_resource_id: str - """ - - _attribute_map = { - 'vm_resource_id': {'key': 'vmResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VMResources, self).__init__(**kwargs) - self.vm_resource_id = kwargs.get('vm_resource_id', None) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py index 4441159dc467c..d123854f06354 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/models/_models_py3.py @@ -18,16 +18,16 @@ class CompanyInfo(msrest.serialization.Model): """Company information of the user to be passed to partners. - :param domain: Domain of the company. - :type domain: str - :param business: Business of the company. - :type business: str - :param employees_number: Number of employees in the company. - :type employees_number: str - :param state: State of the company location. - :type state: str - :param country: Country of the company location. - :type country: str + :ivar domain: Domain of the company. + :vartype domain: str + :ivar business: Business of the company. + :vartype business: str + :ivar employees_number: Number of employees in the company. + :vartype employees_number: str + :ivar state: State of the company location. + :vartype state: str + :ivar country: Country of the company location. + :vartype country: str """ _validation = { @@ -56,6 +56,18 @@ def __init__( country: Optional[str] = None, **kwargs ): + """ + :keyword domain: Domain of the company. + :paramtype domain: str + :keyword business: Business of the company. + :paramtype business: str + :keyword employees_number: Number of employees in the company. + :paramtype employees_number: str + :keyword state: State of the company location. + :paramtype state: str + :keyword country: Country of the company location. + :paramtype country: str + """ super(CompanyInfo, self).__init__(**kwargs) self.domain = domain self.business = business @@ -97,6 +109,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInfoResponse, self).__init__(**kwargs) self.status = None self.version = None @@ -149,6 +163,8 @@ def __init__( self, **kwargs ): + """ + """ super(ElasticCloudDeployment, self).__init__(**kwargs) self.name = None self.deployment_id = None @@ -189,6 +205,8 @@ def __init__( self, **kwargs ): + """ + """ super(ElasticCloudUser, self).__init__(**kwargs) self.email_address = None self.id = None @@ -208,16 +226,16 @@ class ElasticMonitorResource(msrest.serialization.Model): :vartype name: str :ivar type: The type of the monitor resource. :vartype type: str - :param sku: SKU of the monitor resource. - :type sku: ~azure.mgmt.elastic.models.ResourceSku - :param properties: Properties of the monitor resource. - :type properties: ~azure.mgmt.elastic.models.MonitorProperties - :param identity: Identity properties of the monitor resource. - :type identity: ~azure.mgmt.elastic.models.IdentityProperties - :param tags: A set of tags. The tags of the monitor resource. - :type tags: dict[str, str] - :param location: Required. The location of the monitor resource. - :type location: str + :ivar sku: SKU of the monitor resource. + :vartype sku: ~azure.mgmt.elastic.models.ResourceSku + :ivar properties: Properties of the monitor resource. + :vartype properties: ~azure.mgmt.elastic.models.MonitorProperties + :ivar identity: Identity properties of the monitor resource. + :vartype identity: ~azure.mgmt.elastic.models.IdentityProperties + :ivar tags: A set of tags. The tags of the monitor resource. + :vartype tags: dict[str, str] + :ivar location: Required. The location of the monitor resource. + :vartype location: str :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.elastic.models.SystemData """ @@ -252,6 +270,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword sku: SKU of the monitor resource. + :paramtype sku: ~azure.mgmt.elastic.models.ResourceSku + :keyword properties: Properties of the monitor resource. + :paramtype properties: ~azure.mgmt.elastic.models.MonitorProperties + :keyword identity: Identity properties of the monitor resource. + :paramtype identity: ~azure.mgmt.elastic.models.IdentityProperties + :keyword tags: A set of tags. The tags of the monitor resource. + :paramtype tags: dict[str, str] + :keyword location: Required. The location of the monitor resource. + :paramtype location: str + """ super(ElasticMonitorResource, self).__init__(**kwargs) self.id = None self.name = None @@ -267,10 +297,10 @@ def __init__( class ElasticMonitorResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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[~azure.mgmt.elastic.models.ElasticMonitorResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -285,6 +315,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.models.ElasticMonitorResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(ElasticMonitorResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -293,8 +329,8 @@ def __init__( class ElasticMonitorResourceUpdateParameters(msrest.serialization.Model): """Monitor resource update parameters. - :param tags: A set of tags. elastic monitor resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. elastic monitor resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -307,6 +343,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. elastic monitor resource tags. + :paramtype tags: dict[str, str] + """ super(ElasticMonitorResourceUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -314,10 +354,10 @@ def __init__( class ElasticProperties(msrest.serialization.Model): """Elastic Resource Properties. - :param elastic_cloud_user: Details of the user's elastic account. - :type elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser - :param elastic_cloud_deployment: Details of the elastic cloud deployment. - :type elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment + :ivar elastic_cloud_user: Details of the user's elastic account. + :vartype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser + :ivar elastic_cloud_deployment: Details of the elastic cloud deployment. + :vartype elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment """ _attribute_map = { @@ -332,6 +372,12 @@ def __init__( elastic_cloud_deployment: Optional["ElasticCloudDeployment"] = None, **kwargs ): + """ + :keyword elastic_cloud_user: Details of the user's elastic account. + :paramtype elastic_cloud_user: ~azure.mgmt.elastic.models.ElasticCloudUser + :keyword elastic_cloud_deployment: Details of the elastic cloud deployment. + :paramtype elastic_cloud_deployment: ~azure.mgmt.elastic.models.ElasticCloudDeployment + """ super(ElasticProperties, self).__init__(**kwargs) self.elastic_cloud_user = elastic_cloud_user self.elastic_cloud_deployment = elastic_cloud_deployment @@ -340,14 +386,14 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error response body. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.elastic.models.ErrorResponseBody] + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error details. + :vartype details: list[~azure.mgmt.elastic.models.ErrorResponseBody] """ _attribute_map = { @@ -366,6 +412,16 @@ def __init__( details: Optional[List["ErrorResponseBody"]] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message. + :paramtype message: str + :keyword target: Error target. + :paramtype target: str + :keyword details: Error details. + :paramtype details: list[~azure.mgmt.elastic.models.ErrorResponseBody] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -376,13 +432,12 @@ 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. Possible values include: "Include", - "Exclude". - :type action: str or ~azure.mgmt.elastic.models.TagAction + :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. Possible values include: "Include", "Exclude". + :vartype action: str or ~azure.mgmt.elastic.models.TagAction """ _attribute_map = { @@ -399,6 +454,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. Possible values include: "Include", + "Exclude". + :paramtype action: str or ~azure.mgmt.elastic.models.TagAction + """ super(FilteringTag, self).__init__(**kwargs) self.name = name self.value = value @@ -414,8 +478,8 @@ class IdentityProperties(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Managed identity type. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes + :ivar type: Managed identity type. Possible values include: "SystemAssigned". + :vartype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes """ _validation = { @@ -435,6 +499,10 @@ def __init__( type: Optional[Union[str, "ManagedIdentityTypes"]] = None, **kwargs ): + """ + :keyword type: Managed identity type. Possible values include: "SystemAssigned". + :paramtype type: str or ~azure.mgmt.elastic.models.ManagedIdentityTypes + """ super(IdentityProperties, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -444,19 +512,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 subscription 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 subscription logs should be sent for the Monitor resource. - :type send_subscription_logs: bool - :param send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + :vartype send_subscription_logs: bool + :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. - :type send_activity_logs: bool - :param filtering_tags: List of filtering tags to be used for capturing logs. This only takes + :vartype send_activity_logs: bool + :ivar filtering_tags: List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs 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[~azure.mgmt.elastic.models.FilteringTag] + :vartype filtering_tags: list[~azure.mgmt.elastic.models.FilteringTag] """ _attribute_map = { @@ -475,6 +543,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 subscription logs should be sent for the + Monitor resource. + :paramtype send_subscription_logs: bool + :keyword send_activity_logs: Flag specifying if activity logs from Azure resources should be + sent for the Monitor resource. + :paramtype send_activity_logs: bool + :keyword filtering_tags: List of filtering tags to be used for capturing logs. This only takes + effect if SendActivityLogs 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[~azure.mgmt.elastic.models.FilteringTag] + """ super(LogRules, self).__init__(**kwargs) self.send_aad_logs = send_aad_logs self.send_subscription_logs = send_subscription_logs @@ -485,14 +568,14 @@ def __init__( class MonitoredResource(msrest.serialization.Model): """The properties of a resource currently being monitored by the Elastic monitor resource. - :param id: The ARM id of the resource. - :type id: str - :param sending_logs: Flag indicating the status of the resource for sending logs operation to + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_logs: Flag indicating the status of the resource for sending logs operation to Elastic. Possible values include: "True", "False". - :type sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs - :param reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + :vartype sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs + :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 = { @@ -509,6 +592,16 @@ def __init__( reason_for_logs_status: Optional[str] = None, **kwargs ): + """ + :keyword id: The ARM id of the resource. + :paramtype id: str + :keyword sending_logs: Flag indicating the status of the resource for sending logs operation to + Elastic. Possible values include: "True", "False". + :paramtype sending_logs: str or ~azure.mgmt.elastic.models.SendingLogs + :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_logs = sending_logs @@ -518,10 +611,10 @@ def __init__( class MonitoredResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.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[~azure.mgmt.elastic.models.MonitoredResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -536,6 +629,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.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 @@ -552,8 +651,8 @@ class MonitoringTagRules(msrest.serialization.Model): :vartype id: str :ivar type: The type of the rule set. :vartype type: str - :param properties: Properties of the monitoring tag rules. - :type properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties + :ivar properties: Properties of the monitoring tag rules. + :vartype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.elastic.models.SystemData """ @@ -579,6 +678,10 @@ def __init__( properties: Optional["MonitoringTagRulesProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the monitoring tag rules. + :paramtype properties: ~azure.mgmt.elastic.models.MonitoringTagRulesProperties + """ super(MonitoringTagRules, self).__init__(**kwargs) self.name = None self.id = None @@ -590,10 +693,10 @@ def __init__( class MonitoringTagRulesListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.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[~azure.mgmt.elastic.models.MonitoringTagRules] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -608,6 +711,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.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 @@ -616,12 +725,12 @@ def __init__( class MonitoringTagRulesProperties(msrest.serialization.Model): """Definition of the properties for a TagRules resource. - :param provisioning_state: Provisioning state of the monitoring tag rules. Possible values + :ivar provisioning_state: Provisioning state of the monitoring tag rules. Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :param log_rules: Rules for sending logs. - :type log_rules: ~azure.mgmt.elastic.models.LogRules + :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :ivar log_rules: Rules for sending logs. + :vartype log_rules: ~azure.mgmt.elastic.models.LogRules """ _attribute_map = { @@ -636,6 +745,14 @@ def __init__( log_rules: Optional["LogRules"] = None, **kwargs ): + """ + :keyword provisioning_state: Provisioning state of the monitoring tag rules. Possible values + include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", + "Deleted", "NotSpecified". + :paramtype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :keyword log_rules: Rules for sending logs. + :paramtype log_rules: ~azure.mgmt.elastic.models.LogRules + """ super(MonitoringTagRulesProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state self.log_rules = log_rules @@ -646,18 +763,18 @@ class MonitorProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param provisioning_state: Provisioning state of the monitor resource. Possible values include: + :ivar provisioning_state: Provisioning state of the monitor resource. Possible values include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", "NotSpecified". - :type provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState - :param monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + :vartype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :ivar monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. Possible values include: "Enabled", "Disabled". - :type monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus - :param elastic_properties: Elastic cloud properties. - :type elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties - :param user_info: User information. - :type user_info: ~azure.mgmt.elastic.models.UserInfo - :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". + :vartype monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus + :ivar elastic_properties: Elastic cloud properties. + :vartype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties + :ivar user_info: User information. + :vartype user_info: ~azure.mgmt.elastic.models.UserInfo + :ivar liftr_resource_category: Possible values include: "Unknown", "MonitorLogs". :vartype liftr_resource_category: str or ~azure.mgmt.elastic.models.LiftrResourceCategories :ivar liftr_resource_preference: The priority of the resource. :vartype liftr_resource_preference: int @@ -686,6 +803,19 @@ def __init__( user_info: Optional["UserInfo"] = None, **kwargs ): + """ + :keyword provisioning_state: Provisioning state of the monitor resource. Possible values + include: "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", + "Deleted", "NotSpecified". + :paramtype provisioning_state: str or ~azure.mgmt.elastic.models.ProvisioningState + :keyword monitoring_status: Flag specifying if the resource monitoring is enabled or disabled. + Possible values include: "Enabled", "Disabled". + :paramtype monitoring_status: str or ~azure.mgmt.elastic.models.MonitoringStatus + :keyword elastic_properties: Elastic cloud properties. + :paramtype elastic_properties: ~azure.mgmt.elastic.models.ElasticProperties + :keyword user_info: User information. + :paramtype user_info: ~azure.mgmt.elastic.models.UserInfo + """ super(MonitorProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state self.monitoring_status = monitoring_status @@ -698,14 +828,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: Service provider, i.e., Microsoft.Elastic. - :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.Elastic. + :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 = { @@ -724,6 +854,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider, i.e., Microsoft.Elastic. + :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 @@ -734,10 +874,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of GET request to list the Microsoft.Elastic operations. - :param value: List of operations supported by the Microsoft.Elastic provider. - :type value: list[~azure.mgmt.elastic.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.Elastic provider. + :vartype value: list[~azure.mgmt.elastic.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 = { @@ -752,6 +892,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of operations supported by the Microsoft.Elastic provider. + :paramtype value: list[~azure.mgmt.elastic.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 @@ -760,14 +906,14 @@ def __init__( class OperationResult(msrest.serialization.Model): """A Microsoft.Elastic REST API operation. - :param name: Operation name, i.e., {provider}/{resource}/{operation}. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.elastic.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str + :ivar name: Operation name, i.e., {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.elastic.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str """ _attribute_map = { @@ -786,6 +932,16 @@ def __init__( origin: Optional[str] = None, **kwargs ): + """ + :keyword name: Operation name, i.e., {provider}/{resource}/{operation}. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.elastic.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + """ super(OperationResult, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -814,6 +970,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) self.error = None @@ -823,8 +981,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 = { @@ -841,6 +999,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name of the SKU. + :paramtype name: str + """ super(ResourceSku, self).__init__(**kwargs) self.name = name @@ -848,20 +1010,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 ~azure.mgmt.elastic.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 ~azure.mgmt.elastic.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 ~azure.mgmt.elastic.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 ~azure.mgmt.elastic.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -884,6 +1046,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 ~azure.mgmt.elastic.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 ~azure.mgmt.elastic.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 @@ -896,16 +1074,16 @@ def __init__( class UserInfo(msrest.serialization.Model): """User Information to be passed to partners. - :param first_name: First name of the user. - :type first_name: str - :param last_name: Last name of the user. - :type last_name: str - :param company_name: Company name of the user. - :type company_name: str - :param email_address: Email of the user used by Elastic for contacting them if needed. - :type email_address: str - :param company_info: Company information of the user to be passed to partners. - :type company_info: ~azure.mgmt.elastic.models.CompanyInfo + :ivar first_name: First name of the user. + :vartype first_name: str + :ivar last_name: Last name of the user. + :vartype last_name: str + :ivar company_name: Company name of the user. + :vartype company_name: str + :ivar email_address: Email of the user used by Elastic for contacting them if needed. + :vartype email_address: str + :ivar company_info: Company information of the user to be passed to partners. + :vartype company_info: ~azure.mgmt.elastic.models.CompanyInfo """ _validation = { @@ -933,6 +1111,18 @@ def __init__( company_info: Optional["CompanyInfo"] = None, **kwargs ): + """ + :keyword first_name: First name of the user. + :paramtype first_name: str + :keyword last_name: Last name of the user. + :paramtype last_name: str + :keyword company_name: Company name of the user. + :paramtype company_name: str + :keyword email_address: Email of the user used by Elastic for contacting them if needed. + :paramtype email_address: str + :keyword company_info: Company information of the user to be passed to partners. + :paramtype company_info: ~azure.mgmt.elastic.models.CompanyInfo + """ super(UserInfo, self).__init__(**kwargs) self.first_name = first_name self.last_name = last_name @@ -944,11 +1134,11 @@ def __init__( class VMCollectionUpdate(msrest.serialization.Model): """Update VM resource collection. - :param vm_resource_id: ARM id of the VM resource. - :type vm_resource_id: str - :param operation_name: Operation to be performed for given VM. Possible values include: "Add", + :ivar vm_resource_id: ARM id of the VM resource. + :vartype vm_resource_id: str + :ivar operation_name: Operation to be performed for given VM. Possible values include: "Add", "Delete". - :type operation_name: str or ~azure.mgmt.elastic.models.OperationName + :vartype operation_name: str or ~azure.mgmt.elastic.models.OperationName """ _attribute_map = { @@ -963,6 +1153,13 @@ def __init__( operation_name: Optional[Union[str, "OperationName"]] = None, **kwargs ): + """ + :keyword vm_resource_id: ARM id of the VM resource. + :paramtype vm_resource_id: str + :keyword operation_name: Operation to be performed for given VM. Possible values include: + "Add", "Delete". + :paramtype operation_name: str or ~azure.mgmt.elastic.models.OperationName + """ super(VMCollectionUpdate, self).__init__(**kwargs) self.vm_resource_id = vm_resource_id self.operation_name = operation_name @@ -971,10 +1168,10 @@ def __init__( class VMHostListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~azure.mgmt.elastic.models.VMResources] - :param next_link: Link to the next Vm resource Id, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~azure.mgmt.elastic.models.VMResources] + :ivar next_link: Link to the next Vm resource Id, if any. + :vartype next_link: str """ _attribute_map = { @@ -989,6 +1186,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.elastic.models.VMResources] + :keyword next_link: Link to the next Vm resource Id, if any. + :paramtype next_link: str + """ super(VMHostListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -997,10 +1200,10 @@ def __init__( class VMIngestionDetailsResponse(msrest.serialization.Model): """The vm ingestion details to install an agent. - :param cloud_id: The cloudId of given Elastic monitor resource. - :type cloud_id: str - :param ingestion_key: Ingestion details to install agent on given VM. - :type ingestion_key: str + :ivar cloud_id: The cloudId of given Elastic monitor resource. + :vartype cloud_id: str + :ivar ingestion_key: Ingestion details to install agent on given VM. + :vartype ingestion_key: str """ _attribute_map = { @@ -1015,6 +1218,12 @@ def __init__( ingestion_key: Optional[str] = None, **kwargs ): + """ + :keyword cloud_id: The cloudId of given Elastic monitor resource. + :paramtype cloud_id: str + :keyword ingestion_key: Ingestion details to install agent on given VM. + :paramtype ingestion_key: str + """ super(VMIngestionDetailsResponse, self).__init__(**kwargs) self.cloud_id = cloud_id self.ingestion_key = ingestion_key @@ -1023,8 +1232,8 @@ def __init__( class VMResources(msrest.serialization.Model): """The vm resource properties that is currently being monitored by the Elastic monitor resource. - :param vm_resource_id: The ARM id of the VM resource. - :type vm_resource_id: str + :ivar vm_resource_id: The ARM id of the VM resource. + :vartype vm_resource_id: str """ _attribute_map = { @@ -1037,5 +1246,9 @@ def __init__( vm_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword vm_resource_id: The ARM id of the VM resource. + :paramtype vm_resource_id: str + """ super(VMResources, self).__init__(**kwargs) self.vm_resource_id = vm_resource_id diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py index 27e93c36c4561..3bc3915b770c5 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_deployment_info_operations.py @@ -5,22 +5,59 @@ # 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 functools +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) class DeploymentInfoOperations(object): """DeploymentInfoOperations operations. @@ -44,14 +81,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentInfoResponse" - """Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.DeploymentInfoResponse": + """Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor + resource. Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. @@ -71,33 +109,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # 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 = 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) - # 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.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentInfoResponse', pipeline_response) @@ -106,4 +134,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo'} # type: ignore + diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py index b1534528ee0c4..08a8781d784bc 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitored_resources_operations.py @@ -5,23 +5,60 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) class MonitoredResourcesOperations(object): """MonitoredResourcesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoredResourceListResponse"] + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoredResourceListResponse"]: """List the resources currently being monitored by the Elastic monitor resource. List the resources currently being monitored by the Elastic monitor resource. @@ -62,7 +99,8 @@ 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 MonitoredResourceListResponse or the result of cls(response) + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoredResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,36 +109,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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) + + 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('MonitoredResourceListResponse', pipeline_response) + deserialized = self._deserialize("MonitoredResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,12 +148,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py index 247ed242c330a..f8c5226d23099 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_monitors_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, '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_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) class MonitorsOperations(object): """MonitorsOperations operations. @@ -47,18 +272,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ElasticMonitorResourceListResponse"] + **kwargs: Any + ) -> Iterable["_models.ElasticMonitorResourceListResponse"]: """List all monitors under the specified subscription. 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 ElasticMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] + :return: An iterator like instance of either ElasticMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ElasticMonitorResourceListResponse"] @@ -66,34 +293,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - } - 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('ElasticMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("ElasticMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +328,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ElasticMonitorResourceListResponse"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ElasticMonitorResourceListResponse"]: """List all monitors under the specified resource group. List all monitors under the specified resource group. @@ -131,8 +354,10 @@ def list_by_resource_group( belongs. :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 ElasticMonitorResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] + :return: An iterator like instance of either ElasticMonitorResourceListResponse or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.ElasticMonitorResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ElasticMonitorResourceListResponse"] @@ -140,35 +365,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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_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('ElasticMonitorResourceListResponse', pipeline_response) + deserialized = self._deserialize("ElasticMonitorResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -181,24 +402,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ElasticMonitorResource" + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.ElasticMonitorResource": """Get the properties of a specific monitor resource. Get the properties of a specific monitor resource. @@ -218,33 +440,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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 = 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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ElasticMonitorResource', pipeline_response) @@ -253,57 +465,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - monitor_name, # type: str - body=None, # type: Optional["_models.ElasticMonitorResource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ElasticMonitorResource" + resource_group_name: str, + monitor_name: str, + body: Optional["_models.ElasticMonitorResource"] = None, + **kwargs: Any + ) -> "_models.ElasticMonitorResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ElasticMonitorResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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') + 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, 'ElasticMonitorResource') + _json = self._serialize.body(body, 'ElasticMonitorResource') 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.ResourceProviderDefaultErrorResponse, 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('ElasticMonitorResource', pipeline_response) @@ -315,16 +517,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - monitor_name, # type: str - body=None, # type: Optional["_models.ElasticMonitorResource"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ElasticMonitorResource"] + resource_group_name: str, + monitor_name: str, + body: Optional["_models.ElasticMonitorResource"] = None, + **kwargs: Any + ) -> LROPoller["_models.ElasticMonitorResource"]: """Create a monitor resource. Create a monitor resource. @@ -338,15 +542,19 @@ def begin_create( :type body: ~azure.mgmt.elastic.models.ElasticMonitorResource :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 ElasticMonitorResource 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 ElasticMonitorResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elastic.models.ElasticMonitorResource] - :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.ElasticMonitorResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -358,27 +566,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('ElasticMonitorResource', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -390,16 +592,17 @@ 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.Elastic/monitors/{monitorName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - monitor_name, # type: str - body=None, # type: Optional["_models.ElasticMonitorResourceUpdateParameters"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ElasticMonitorResource" + resource_group_name: str, + monitor_name: str, + body: Optional["_models.ElasticMonitorResourceUpdateParameters"] = None, + **kwargs: Any + ) -> "_models.ElasticMonitorResource": """Update a monitor resource. Update a monitor resource. @@ -421,41 +624,31 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + 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, 'ElasticMonitorResourceUpdateParameters') + _json = self._serialize.body(body, 'ElasticMonitorResourceUpdateParameters') 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( + 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.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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ElasticMonitorResource', pipeline_response) @@ -464,61 +657,52 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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 = 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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a monitor resource. Delete a monitor resource. @@ -530,15 +714,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', @@ -552,21 +738,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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -578,4 +757,5 @@ 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.Elastic/monitors/{monitorName}'} # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py index 1333e29f80019..ec7236e77bdc0 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Elastic/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 + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """List all operations provided by Microsoft.Elastic. List all operations provided by Microsoft.Elastic. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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 +124,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py index 82a4bf4ecbb41..b98735b4a7c09 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_tag_rules_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: str, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TagRulesOperations(object): """TagRulesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MonitoringTagRulesListResponse"] + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoringTagRulesListResponse"]: """List the tag rules for a given monitor resource. List the tag rules for a given monitor resource. @@ -64,7 +222,8 @@ 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) + :return: An iterator like instance of either MonitoringTagRulesListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elastic.models.MonitoringTagRulesListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,36 +232,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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.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) @@ -115,26 +271,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules'} # type: ignore + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - monitor_name, # type: str - rule_set_name, # type: str - body=None, # type: Optional["_models.MonitoringTagRules"] - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringTagRules" + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + body: Optional["_models.MonitoringTagRules"] = None, + **kwargs: Any + ) -> "_models.MonitoringTagRules": """Create or update a tag rule set for a given monitor resource. Create or update a tag rule set for a given monitor resource. @@ -158,42 +315,32 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -202,16 +349,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - monitor_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringTagRules" + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> "_models.MonitoringTagRules": """Get a tag rule set for a given monitor resource. Get a tag rule set for a given monitor resource. @@ -233,34 +382,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MonitoringTagRules', pipeline_response) @@ -269,64 +408,55 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - monitor_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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_delete_request_initial( + 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._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.ResourceProviderDefaultErrorResponse, 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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - monitor_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a tag rule set for a given monitor resource. Delete a tag rule set for a given monitor resource. @@ -340,15 +470,17 @@ def begin_delete( :type rule_set_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', @@ -363,22 +495,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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_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: @@ -390,4 +514,5 @@ 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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}'} # type: ignore diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py index 223d946dd7f0e..e1749cb2f5716 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_collection_operations.py @@ -5,22 +5,69 @@ # 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 functools +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + json=json, + content=content, + **kwargs + ) class VMCollectionOperations(object): """VMCollectionOperations operations. @@ -44,14 +91,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def update( self, - resource_group_name, # type: str - monitor_name, # type: str - body=None, # type: Optional["_models.VMCollectionUpdate"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + monitor_name: str, + body: Optional["_models.VMCollectionUpdate"] = None, + **kwargs: Any + ) -> None: """Update the vm details that will be monitored by the Elastic monitor resource. Update the vm details that will be monitored by the Elastic monitor resource. @@ -73,44 +120,35 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + 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, 'VMCollectionUpdate') + _json = self._serialize.body(body, 'VMCollectionUpdate') 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_update_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.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.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate'} # type: ignore + diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py index f197afb139505..8fc837416b208 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_host_operations.py @@ -5,23 +5,60 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) class VMHostOperations(object): """VMHostOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VMHostListResponse"] + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.VMHostListResponse"]: """List the vm resources currently being monitored by the Elastic monitor resource. List the vm resources currently being monitored by the Elastic monitor resource. @@ -71,36 +108,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - '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) + + 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('VMHostListResponse', pipeline_response) + deserialized = self._deserialize("VMHostListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,12 +147,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.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py index 70920a3e0d44d..b9f5c05568429 100644 --- a/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py +++ b/sdk/elastic/azure-mgmt-elastic/azure/mgmt/elastic/operations/_vm_ingestion_operations.py @@ -5,22 +5,59 @@ # 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 functools +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_details_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 + ) class VMIngestionOperations(object): """VMIngestionOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def details( self, - resource_group_name, # type: str - monitor_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VMIngestionDetailsResponse" + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.VMIngestionDetailsResponse": """List the vm ingestion details that will be monitored by the Elastic monitor resource. List the vm ingestion details that will be monitored by the Elastic monitor resource. @@ -70,33 +107,23 @@ def details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.details.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 = build_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + template_url=self.details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VMIngestionDetailsResponse', pipeline_response) @@ -105,4 +132,6 @@ def details( return cls(pipeline_response, deserialized, {}) return deserialized + details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails'} # type: ignore +