From 34716ac8b0758504d8990ed964901a1629cdce24 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 19 May 2022 21:59:29 +0800 Subject: [PATCH] [AutoRelease] t2-dynatrace-2022-05-10-18455(Do not merge) (#24368) * code and test * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines Co-authored-by: Yuchao Yan --- .../azure-mgmt-dynatrace/CHANGELOG.md | 5 + sdk/dynatrace/azure-mgmt-dynatrace/LICENSE | 21 + .../azure-mgmt-dynatrace/MANIFEST.in | 6 + sdk/dynatrace/azure-mgmt-dynatrace/README.md | 30 + sdk/dynatrace/azure-mgmt-dynatrace/_meta.json | 11 + .../azure-mgmt-dynatrace/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/dynatrace/__init__.py | 18 + .../azure/mgmt/dynatrace/_configuration.py | 73 + .../dynatrace/_dynatrace_observability.py | 106 + .../azure/mgmt/dynatrace/_metadata.json | 105 + .../azure/mgmt/dynatrace/_patch.py | 31 + .../azure/mgmt/dynatrace/_vendor.py | 27 + .../azure/mgmt/dynatrace/_version.py | 9 + .../azure/mgmt/dynatrace/aio/__init__.py | 15 + .../mgmt/dynatrace/aio/_configuration.py | 72 + .../dynatrace/aio/_dynatrace_observability.py | 103 + .../azure/mgmt/dynatrace/aio/_patch.py | 31 + .../mgmt/dynatrace/aio/operations/__init__.py | 19 + .../aio/operations/_monitors_operations.py | 1117 +++++++++ .../dynatrace/aio/operations/_operations.py | 118 + .../operations/_single_sign_on_operations.py | 335 +++ .../aio/operations/_tag_rules_operations.py | 516 ++++ .../azure/mgmt/dynatrace/models/__init__.py | 141 ++ .../models/_dynatrace_observability_enums.py | 186 ++ .../mgmt/dynatrace/models/_models_py3.py | 2078 +++++++++++++++++ .../mgmt/dynatrace/operations/__init__.py | 19 + .../operations/_monitors_operations.py | 1610 +++++++++++++ .../mgmt/dynatrace/operations/_operations.py | 146 ++ .../operations/_single_sign_on_operations.py | 458 ++++ .../operations/_tag_rules_operations.py | 722 ++++++ .../azure/mgmt/dynatrace/py.typed | 1 + .../azure-mgmt-dynatrace/sdk_packaging.toml | 9 + sdk/dynatrace/azure-mgmt-dynatrace/setup.py | 74 + sdk/dynatrace/ci.yml | 33 + shared_requirements.txt | 2 + 36 files changed, 8249 insertions(+) create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/CHANGELOG.md create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/LICENSE create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/MANIFEST.in create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/README.md create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/_meta.json create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_configuration.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_patch.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_vendor.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_version.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_configuration.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_patch.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/py.typed create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/sdk_packaging.toml create mode 100644 sdk/dynatrace/azure-mgmt-dynatrace/setup.py create mode 100644 sdk/dynatrace/ci.yml diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/CHANGELOG.md b/sdk/dynatrace/azure-mgmt-dynatrace/CHANGELOG.md new file mode 100644 index 000000000000..6511ec288a1d --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2022-05-19) + +* Initial Release diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/LICENSE b/sdk/dynatrace/azure-mgmt-dynatrace/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +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. diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/MANIFEST.in b/sdk/dynatrace/azure-mgmt-dynatrace/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/README.md b/sdk/dynatrace/azure-mgmt-dynatrace/README.md new file mode 100644 index 000000000000..5d81f9ad4d46 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Dynatrace Management Client Library. +This package has been tested with Python 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Dynatrace Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-dynatrace%2FREADME.png) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json b/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json new file mode 100644 index 000000000000..2ac86be63aa6 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "11830d3ce01db4f39a41dc37a86075b125c87fdc", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/dynatrace/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/dynatrace/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py new file mode 100644 index 000000000000..ad16de1b3395 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py @@ -0,0 +1,18 @@ +# 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 ._dynatrace_observability import DynatraceObservability +from ._version import VERSION + +__version__ = VERSION +__all__ = ['DynatraceObservability'] + +# `._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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_configuration.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_configuration.py new file mode 100644 index 000000000000..19975c08a1cf --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class DynatraceObservabilityConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DynatraceObservability. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DynatraceObservabilityConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-dynatrace/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py new file mode 100644 index 000000000000..21c0c63a167f --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py @@ -0,0 +1,106 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import DynatraceObservabilityConfiguration +from .operations import MonitorsOperations, Operations, SingleSignOnOperations, TagRulesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class DynatraceObservability: + """DynatraceObservability. + + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.dynatrace.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.dynatrace.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: azure.mgmt.dynatrace.operations.TagRulesOperations + :ivar single_sign_on: SingleSignOnOperations operations + :vartype single_sign_on: azure.mgmt.dynatrace.operations.SingleSignOnOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DynatraceObservabilityConfiguration(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._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.single_sign_on = SingleSignOnOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> 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.rest.HttpResponse + """ + + 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 + self._client.close() + + def __enter__(self): + # type: () -> DynatraceObservability + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json new file mode 100644 index 000000000000..4d59dd1fd4d2 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json @@ -0,0 +1,105 @@ +{ + "chosen_version": "2021-09-01-preview", + "total_api_version_list": ["2021-09-01-preview"], + "client": { + "name": "DynatraceObservability", + "filename": "_dynatrace_observability", + "description": "DynatraceObservability.", + "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\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DynatraceObservabilityConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DynatraceObservabilityConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "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": { + "monitors": "MonitorsOperations", + "operations": "Operations", + "tag_rules": "TagRulesOperations", + "single_sign_on": "SingleSignOnOperations" + } +} \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_patch.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_vendor.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_version.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py new file mode 100644 index 000000000000..88d055335ba5 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._dynatrace_observability import DynatraceObservability +__all__ = ['DynatraceObservability'] + +# `._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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_configuration.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_configuration.py new file mode 100644 index 000000000000..8be7613f59c6 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DynatraceObservabilityConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for DynatraceObservability. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DynatraceObservabilityConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-dynatrace/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py new file mode 100644 index 000000000000..9b9b13f386d9 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_dynatrace_observability.py @@ -0,0 +1,103 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import DynatraceObservabilityConfiguration +from .operations import MonitorsOperations, Operations, SingleSignOnOperations, TagRulesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class DynatraceObservability: + """DynatraceObservability. + + :ivar monitors: MonitorsOperations operations + :vartype monitors: azure.mgmt.dynatrace.aio.operations.MonitorsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.dynatrace.aio.operations.Operations + :ivar tag_rules: TagRulesOperations operations + :vartype tag_rules: azure.mgmt.dynatrace.aio.operations.TagRulesOperations + :ivar single_sign_on: SingleSignOnOperations operations + :vartype single_sign_on: azure.mgmt.dynatrace.aio.operations.SingleSignOnOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DynatraceObservabilityConfiguration(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._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.single_sign_on = SingleSignOnOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> 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.rest.AsyncHttpResponse + """ + + 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() + + async def __aenter__(self) -> "DynatraceObservability": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_patch.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/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/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py new file mode 100644 index 000000000000..8fbbc8d96450 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# 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 ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_operations import SingleSignOnOperations + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', +] diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py new file mode 100644 index 000000000000..068a5c1ae748 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_monitors_operations.py @@ -0,0 +1,1117 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +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_or_update_request_initial, build_delete_request_initial, build_get_account_credentials_request, build_get_request, build_get_sso_details_request, build_get_vm_host_payload_request, build_list_app_services_request, build_list_by_resource_group_request, build_list_by_subscription_id_request, build_list_hosts_request, build_list_linkable_environments_request, build_list_monitored_resources_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitorsOperations: + """MonitorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_account_credentials( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.AccountInfoSecure": + """Gets the user account credentials for a Monitor. + + Gets the user account credentials for a Monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountInfoSecure, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.AccountInfoSecure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountInfoSecure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_account_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get_account_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccountInfoSecure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getAccountCredentials"} # type: ignore + + + @distributed_trace + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Dynatrace monitor resource. + + List the resources currently being monitored by the Dynatrace monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_monitored_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources"} # type: ignore + + @distributed_trace_async + async def get_vm_host_payload( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.VMExtensionPayload": + """Returns the payload that needs to be passed in the request body for installing Dynatrace agent + on a VM. + + Returns the payload that needs to be passed in the request body for installing Dynatrace agent + on a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VMExtensionPayload, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.VMExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_vm_host_payload_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get_vm_host_payload.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VMExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_vm_host_payload.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.MonitorResource": + """Get a MonitorResource. + + Get a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitorResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.MonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResource", + **kwargs: Any + ) -> "_models.MonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'MonitorResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitorResource"]: + """Create a MonitorResource. + + Create a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.MonitorResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitorResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.MonitorResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitorResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResourceUpdate", + **kwargs: Any + ) -> "_models.MonitorResource": + """Update a MonitorResource. + + Update a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param resource: The resource properties to be updated. + :type resource: ~azure.mgmt.dynatrace.models.MonitorResourceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitorResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.MonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'MonitorResourceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a MonitorResource. + + Delete a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + @distributed_trace + def list_by_subscription_id( + self, + **kwargs: Any + ) -> AsyncIterable["_models.MonitorResourceListResult"]: + """List all MonitorResource by subscriptionId. + + List all MonitorResource by subscriptionId. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("MonitorResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MonitorResourceListResult"]: + """List MonitorResource resources by resource group. + + List MonitorResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + 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("MonitorResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors"} # type: ignore + + @distributed_trace + def list_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VMHostsListResponse"]: + """List the compute resources currently being monitored by the Dynatrace resource. + + List the compute resources currently being monitored by the Dynatrace resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VMHostsListResponse or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.VMHostsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMHostsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_hosts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("VMHostsListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts"} # type: ignore + + @distributed_trace + def list_app_services( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppServiceListResponse"]: + """Gets list of App Services with Dynatrace PaaS OneAgent enabled. + + Gets list of App Services with Dynatrace PaaS OneAgent enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.AppServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_app_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_app_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_app_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("AppServiceListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_app_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices"} # type: ignore + + @distributed_trace_async + async def get_sso_details( + self, + resource_group_name: str, + monitor_name: str, + request: Optional["_models.SSODetailsRequest"] = None, + **kwargs: Any + ) -> "_models.SSODetailsResponse": + """Gets the SSO configuration details from the partner. + + Gets the SSO configuration details from the partner. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param request: The details of the get sso details request. Default value is None. + :type request: ~azure.mgmt.dynatrace.models.SSODetailsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SSODetailsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SSODetailsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if request is not None: + _json = self._serialize.body(request, 'SSODetailsRequest') + else: + _json = None + + request = build_get_sso_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.get_sso_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SSODetailsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sso_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails"} # type: ignore + + + @distributed_trace + def list_linkable_environments( + self, + resource_group_name: str, + monitor_name: str, + request: "_models.LinkableEnvironmentRequest", + **kwargs: Any + ) -> AsyncIterable["_models.LinkableEnvironmentListResponse"]: + """Gets all the Dynatrace environments that a user can link a azure resource to. + + Gets all the Dynatrace environments that a user can link a azure resource to. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param request: The details of the linkable environment request. + :type request: ~azure.mgmt.dynatrace.models.LinkableEnvironmentRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkableEnvironmentListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkableEnvironmentListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + _json = self._serialize.body(request, 'LinkableEnvironmentRequest') + + request = build_list_linkable_environments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_linkable_environments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + _json = self._serialize.body(request, 'LinkableEnvironmentRequest') + + request = build_list_linkable_environments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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("LinkableEnvironmentListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_linkable_environments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py new file mode 100644 index 000000000000..49b4dade1bbe --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +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]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """List the operations for Dynatrace.Observability. + + List the operations for Dynatrace.Observability. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Dynatrace.Observability/operations"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py new file mode 100644 index 000000000000..77defc5d9d61 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_single_sign_on_operations.py @@ -0,0 +1,335 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._single_sign_on_operations import build_create_or_update_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SingleSignOnOperations: + """SingleSignOnOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + resource: "_models.DynatraceSingleSignOnResource", + **kwargs: Any + ) -> "_models.DynatraceSingleSignOnResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'DynatraceSingleSignOnResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + resource: "_models.DynatraceSingleSignOnResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DynatraceSingleSignOnResource"]: + """Create a DynatraceSingleSignOnResource. + + Create a DynatraceSingleSignOnResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: Single Sign On Configuration Name. + :type configuration_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DynatraceSingleSignOnResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.DynatraceSingleSignOnResource": + """Get a DynatraceSingleSignOnResource. + + Get a DynatraceSingleSignOnResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: Single Sign On Configuration Name. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DynatraceSingleSignOnResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DynatraceSingleSignOnResourceListResult"]: + """List all DynatraceSingleSignOnResource by monitorName. + + List all DynatraceSingleSignOnResource by monitorName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DynatraceSingleSignOnResourceListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("DynatraceSingleSignOnResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py new file mode 100644 index 000000000000..13641a350556 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/aio/operations/_tag_rules_operations.py @@ -0,0 +1,516 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +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 +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_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TagRulesOperations: + """TagRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> "_models.TagRule": + """Get a TagRule. + + Get a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagRule, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.TagRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRule", + **kwargs: Any + ) -> "_models.TagRule": + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'TagRule') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRule", + **kwargs: Any + ) -> AsyncLROPoller["_models.TagRule"]: + """Create a TagRule. + + Create a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.TagRule + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TagRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dynatrace.models.TagRule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('TagRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRuleUpdate", + **kwargs: Any + ) -> "_models.TagRule": + """Update a TagRule. + + Update a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :param resource: The resource properties to be updated. + :type resource: ~azure.mgmt.dynatrace.models.TagRuleUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagRule, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.TagRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'TagRuleUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2021-09-01-preview") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a TagRule. + + Delete a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.TagRuleListResult"]: + """List all TagRule by monitorName. + + List all TagRule by monitorName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dynatrace.models.TagRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("TagRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py new file mode 100644 index 000000000000..32a7f2f7e73e --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/__init__.py @@ -0,0 +1,141 @@ +# 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 ._models_py3 import AccountInfo +from ._models_py3 import AccountInfoSecure +from ._models_py3 import AppServiceInfo +from ._models_py3 import AppServiceListResponse +from ._models_py3 import DynatraceEnvironmentProperties +from ._models_py3 import DynatraceSingleSignOnProperties +from ._models_py3 import DynatraceSingleSignOnResource +from ._models_py3 import DynatraceSingleSignOnResourceListResult +from ._models_py3 import EnvironmentInfo +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import FilteringTag +from ._models_py3 import IdentityProperties +from ._models_py3 import LinkableEnvironmentListResponse +from ._models_py3 import LinkableEnvironmentRequest +from ._models_py3 import LinkableEnvironmentResponse +from ._models_py3 import LogRules +from ._models_py3 import MetricRules +from ._models_py3 import MonitorResource +from ._models_py3 import MonitorResourceListResult +from ._models_py3 import MonitorResourceUpdate +from ._models_py3 import MonitoredResource +from ._models_py3 import MonitoredResourceListResponse +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PlanData +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import SSODetailsRequest +from ._models_py3 import SSODetailsResponse +from ._models_py3 import SystemData +from ._models_py3 import TagRule +from ._models_py3 import TagRuleListResult +from ._models_py3 import TagRuleUpdate +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserInfo +from ._models_py3 import VMExtensionPayload +from ._models_py3 import VMHostsListResponse +from ._models_py3 import VMInfo + + +from ._dynatrace_observability_enums import ( + ActionType, + AutoUpdateSetting, + AvailabilityState, + CreatedByType, + LiftrResourceCategories, + LogModule, + ManagedIdentityType, + MarketplaceSubscriptionStatus, + MonitoringStatus, + MonitoringType, + Origin, + ProvisioningState, + SSOStatus, + SendAadLogsStatus, + SendActivityLogsStatus, + SendSubscriptionLogsStatus, + SendingLogsStatus, + SendingMetricsStatus, + SingleSignOnStates, + TagAction, + UpdateStatus, +) + +__all__ = [ + 'AccountInfo', + 'AccountInfoSecure', + 'AppServiceInfo', + 'AppServiceListResponse', + 'DynatraceEnvironmentProperties', + 'DynatraceSingleSignOnProperties', + 'DynatraceSingleSignOnResource', + 'DynatraceSingleSignOnResourceListResult', + 'EnvironmentInfo', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'FilteringTag', + 'IdentityProperties', + 'LinkableEnvironmentListResponse', + 'LinkableEnvironmentRequest', + 'LinkableEnvironmentResponse', + 'LogRules', + 'MetricRules', + 'MonitorResource', + 'MonitorResourceListResult', + 'MonitorResourceUpdate', + 'MonitoredResource', + 'MonitoredResourceListResponse', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PlanData', + 'ProxyResource', + 'Resource', + 'SSODetailsRequest', + 'SSODetailsResponse', + 'SystemData', + 'TagRule', + 'TagRuleListResult', + 'TagRuleUpdate', + 'TrackedResource', + 'UserAssignedIdentity', + 'UserInfo', + 'VMExtensionPayload', + 'VMHostsListResponse', + 'VMInfo', + 'ActionType', + 'AutoUpdateSetting', + 'AvailabilityState', + 'CreatedByType', + 'LiftrResourceCategories', + 'LogModule', + 'ManagedIdentityType', + 'MarketplaceSubscriptionStatus', + 'MonitoringStatus', + 'MonitoringType', + 'Origin', + 'ProvisioningState', + 'SSOStatus', + 'SendAadLogsStatus', + 'SendActivityLogsStatus', + 'SendSubscriptionLogsStatus', + 'SendingLogsStatus', + 'SendingMetricsStatus', + 'SingleSignOnStates', + 'TagAction', + 'UpdateStatus', +] diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py new file mode 100644 index 000000000000..002ece5008f2 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_dynatrace_observability_enums.py @@ -0,0 +1,186 @@ +# 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 enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class AutoUpdateSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Update settings of OneAgent. + """ + + ENABLED = "ENABLED" + DISABLED = "DISABLED" + +class AvailabilityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The availability state of OneAgent. + """ + + CRASHED = "CRASHED" + LOST = "LOST" + MONITORED = "MONITORED" + PRE_MONITORED = "PRE_MONITORED" + SHUTDOWN = "SHUTDOWN" + UNEXPECTED_SHUTDOWN = "UNEXPECTED_SHUTDOWN" + UNKNOWN = "UNKNOWN" + UNMONITORED = "UNMONITORED" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class LiftrResourceCategories(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Liftr resource category + """ + + UNKNOWN = "Unknown" + MONITOR_LOGS = "MonitorLogs" + +class LogModule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Tells whether log modules are enabled or not + """ + + ENABLED = "ENABLED" + DISABLED = "DISABLED" + +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The kind of managed identity assigned to this resource. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_AND_USER_ASSIGNED = "SystemAndUserAssigned" + +class MarketplaceSubscriptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in + time, the resource will go in Suspended state. + """ + + ACTIVE = "Active" + SUSPENDED = "Suspended" + +class MonitoringStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Flag specifying if the resource monitoring is enabled or disabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class MonitoringType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The monitoring mode of OneAgent + """ + + CLOUD_INFRASTRUCTURE = "CLOUD_INFRASTRUCTURE" + FULL_STACK = "FULL_STACK" + +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the monitoring resource + """ + + ACCEPTED = "Accepted" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETED = "Deleted" + NOT_SPECIFIED = "NotSpecified" + +class SendAadLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether AAD logs are being sent. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class SendActivityLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether activity logs are being sent. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class SendingLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether logs are being sent. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class SendingMetricsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether metrics are being sent. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class SendSubscriptionLogsStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether subscription logs are being sent. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class SingleSignOnStates(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Various states of the SSO resource + """ + + INITIAL = "Initial" + ENABLE = "Enable" + DISABLE = "Disable" + EXISTING = "Existing" + +class SSOStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether SSO is enabled or not + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class TagAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Valid actions for a filtering tag. Exclusion takes priority over inclusion. + """ + + INCLUDE = "Include" + EXCLUDE = "Exclude" + +class UpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current update status of OneAgent. + """ + + INCOMPATIBLE = "INCOMPATIBLE" + OUTDATED = "OUTDATED" + SCHEDULED = "SCHEDULED" + SUPPRESSED = "SUPPRESSED" + UNKNOWN = "UNKNOWN" + UP2_DATE = "UP2DATE" + UPDATE_IN_PROGRESS = "UPDATE_IN_PROGRESS" + UPDATE_PENDING = "UPDATE_PENDING" + UPDATE_PROBLEM = "UPDATE_PROBLEM" diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py new file mode 100644 index 000000000000..9f3d93f14fc6 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/models/_models_py3.py @@ -0,0 +1,2078 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._dynatrace_observability_enums import * + + +class AccountInfo(msrest.serialization.Model): + """Dynatrace Account Information. + + :ivar account_id: Account Id of the account this environment is linked to. + :vartype account_id: str + :ivar region_id: Region in which the account is created. + :vartype region_id: str + """ + + _attribute_map = { + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'region_id': {'key': 'regionId', 'type': 'str'}, + } + + def __init__( + self, + *, + account_id: Optional[str] = None, + region_id: Optional[str] = None, + **kwargs + ): + """ + :keyword account_id: Account Id of the account this environment is linked to. + :paramtype account_id: str + :keyword region_id: Region in which the account is created. + :paramtype region_id: str + """ + super(AccountInfo, self).__init__(**kwargs) + self.account_id = account_id + self.region_id = region_id + + +class AccountInfoSecure(msrest.serialization.Model): + """Dynatrace account API Key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_id: Account Id of the account this environment is linked to. + :vartype account_id: str + :ivar api_key: API Key of the user account. + :vartype api_key: str + :ivar region_id: Region in which the account is created. + :vartype region_id: str + """ + + _validation = { + 'account_id': {'readonly': True}, + 'api_key': {'readonly': True}, + 'region_id': {'readonly': True}, + } + + _attribute_map = { + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'region_id': {'key': 'regionId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AccountInfoSecure, self).__init__(**kwargs) + self.account_id = None + self.api_key = None + self.region_id = None + + +class AppServiceInfo(msrest.serialization.Model): + """Details of App Services having Dynatrace OneAgent installed. + + :ivar resource_id: App service resource ID. + :vartype resource_id: str + :ivar version: Version of the Dynatrace agent installed on the App Service. + :vartype version: str + :ivar monitoring_type: The monitoring mode of OneAgent. Possible values include: + "CLOUD_INFRASTRUCTURE", "FULL_STACK". + :vartype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType + :ivar auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + "DISABLED". + :vartype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting + :ivar update_status: The current update status of OneAgent. Possible values include: + "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", + "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :vartype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus + :ivar availability_state: The availability state of OneAgent. Possible values include: + "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + "UNMONITORED". + :vartype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState + :ivar log_module: Tells whether log modules are enabled or not. Possible values include: + "ENABLED", "DISABLED". + :vartype log_module: str or ~azure.mgmt.dynatrace.models.LogModule + :ivar host_group: The name of the host group. + :vartype host_group: str + :ivar host_name: The name of the host. + :vartype host_name: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'monitoring_type': {'key': 'monitoringType', 'type': 'str'}, + 'auto_update_setting': {'key': 'autoUpdateSetting', 'type': 'str'}, + 'update_status': {'key': 'updateStatus', 'type': 'str'}, + 'availability_state': {'key': 'availabilityState', 'type': 'str'}, + 'log_module': {'key': 'logModule', 'type': 'str'}, + 'host_group': {'key': 'hostGroup', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + version: Optional[str] = None, + monitoring_type: Optional[Union[str, "MonitoringType"]] = None, + auto_update_setting: Optional[Union[str, "AutoUpdateSetting"]] = None, + update_status: Optional[Union[str, "UpdateStatus"]] = None, + availability_state: Optional[Union[str, "AvailabilityState"]] = None, + log_module: Optional[Union[str, "LogModule"]] = None, + host_group: Optional[str] = None, + host_name: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: App service resource ID. + :paramtype resource_id: str + :keyword version: Version of the Dynatrace agent installed on the App Service. + :paramtype version: str + :keyword monitoring_type: The monitoring mode of OneAgent. Possible values include: + "CLOUD_INFRASTRUCTURE", "FULL_STACK". + :paramtype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType + :keyword auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + "DISABLED". + :paramtype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting + :keyword update_status: The current update status of OneAgent. Possible values include: + "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", + "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :paramtype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus + :keyword availability_state: The availability state of OneAgent. Possible values include: + "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + "UNMONITORED". + :paramtype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState + :keyword log_module: Tells whether log modules are enabled or not. Possible values include: + "ENABLED", "DISABLED". + :paramtype log_module: str or ~azure.mgmt.dynatrace.models.LogModule + :keyword host_group: The name of the host group. + :paramtype host_group: str + :keyword host_name: The name of the host. + :paramtype host_name: str + """ + super(AppServiceInfo, self).__init__(**kwargs) + self.resource_id = resource_id + self.version = version + self.monitoring_type = monitoring_type + self.auto_update_setting = auto_update_setting + self.update_status = update_status + self.availability_state = availability_state + self.log_module = log_module + self.host_group = host_group + self.host_name = host_name + + +class AppServiceListResponse(msrest.serialization.Model): + """Response of a list App Services Operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.AppServiceInfo] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppServiceInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AppServiceInfo"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.AppServiceInfo] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(AppServiceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DynatraceEnvironmentProperties(msrest.serialization.Model): + """Properties of the Dynatrace environment. + + :ivar user_id: User id. + :vartype user_id: str + :ivar account_info: Dynatrace Account Information. + :vartype account_info: ~azure.mgmt.dynatrace.models.AccountInfo + :ivar environment_info: Dynatrace Environment Information. + :vartype environment_info: ~azure.mgmt.dynatrace.models.EnvironmentInfo + :ivar single_sign_on_properties: The details of a Dynatrace single sign-on. + :vartype single_sign_on_properties: + ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnProperties + """ + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'account_info': {'key': 'accountInfo', 'type': 'AccountInfo'}, + 'environment_info': {'key': 'environmentInfo', 'type': 'EnvironmentInfo'}, + 'single_sign_on_properties': {'key': 'singleSignOnProperties', 'type': 'DynatraceSingleSignOnProperties'}, + } + + def __init__( + self, + *, + user_id: Optional[str] = None, + account_info: Optional["AccountInfo"] = None, + environment_info: Optional["EnvironmentInfo"] = None, + single_sign_on_properties: Optional["DynatraceSingleSignOnProperties"] = None, + **kwargs + ): + """ + :keyword user_id: User id. + :paramtype user_id: str + :keyword account_info: Dynatrace Account Information. + :paramtype account_info: ~azure.mgmt.dynatrace.models.AccountInfo + :keyword environment_info: Dynatrace Environment Information. + :paramtype environment_info: ~azure.mgmt.dynatrace.models.EnvironmentInfo + :keyword single_sign_on_properties: The details of a Dynatrace single sign-on. + :paramtype single_sign_on_properties: + ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnProperties + """ + super(DynatraceEnvironmentProperties, self).__init__(**kwargs) + self.user_id = user_id + self.account_info = account_info + self.environment_info = environment_info + self.single_sign_on_properties = single_sign_on_properties + + +class DynatraceSingleSignOnProperties(msrest.serialization.Model): + """The details of a Dynatrace single sign-on. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar single_sign_on_state: State of Single Sign On. Possible values include: "Initial", + "Enable", "Disable", "Existing". + :vartype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates + :ivar enterprise_app_id: Version of the Dynatrace agent installed on the VM. + :vartype enterprise_app_id: str + :ivar single_sign_on_url: The login URL specific to this Dynatrace Environment. + :vartype single_sign_on_url: str + :ivar aad_domains: array of Aad(azure active directory) domains. + :vartype aad_domains: list[str] + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'single_sign_on_state': {'key': 'singleSignOnState', 'type': 'str'}, + 'enterprise_app_id': {'key': 'enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + 'aad_domains': {'key': 'aadDomains', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, + enterprise_app_id: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + aad_domains: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword single_sign_on_state: State of Single Sign On. Possible values include: "Initial", + "Enable", "Disable", "Existing". + :paramtype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates + :keyword enterprise_app_id: Version of the Dynatrace agent installed on the VM. + :paramtype enterprise_app_id: str + :keyword single_sign_on_url: The login URL specific to this Dynatrace Environment. + :paramtype single_sign_on_url: str + :keyword aad_domains: array of Aad(azure active directory) domains. + :paramtype aad_domains: list[str] + """ + super(DynatraceSingleSignOnProperties, self).__init__(**kwargs) + self.single_sign_on_state = single_sign_on_state + self.enterprise_app_id = enterprise_app_id + self.single_sign_on_url = single_sign_on_url + self.aad_domains = aad_domains + self.provisioning_state = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class DynatraceSingleSignOnResource(ProxyResource): + """Single sign-on configurations for a given monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: System metadata for this resource. + :vartype system_data: ~azure.mgmt.dynatrace.models.SystemData + :ivar single_sign_on_state: State of Single Sign On. Possible values include: "Initial", + "Enable", "Disable", "Existing". + :vartype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates + :ivar enterprise_app_id: Version of the Dynatrace agent installed on the VM. + :vartype enterprise_app_id: str + :ivar single_sign_on_url: The login URL specific to this Dynatrace Environment. + :vartype single_sign_on_url: str + :ivar aad_domains: array of Aad(azure active directory) domains. + :vartype aad_domains: list[str] + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'single_sign_on_state': {'key': 'properties.singleSignOnState', 'type': 'str'}, + 'enterprise_app_id': {'key': 'properties.enterpriseAppId', 'type': 'str'}, + 'single_sign_on_url': {'key': 'properties.singleSignOnUrl', 'type': 'str'}, + 'aad_domains': {'key': 'properties.aadDomains', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + single_sign_on_state: Optional[Union[str, "SingleSignOnStates"]] = None, + enterprise_app_id: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + aad_domains: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword single_sign_on_state: State of Single Sign On. Possible values include: "Initial", + "Enable", "Disable", "Existing". + :paramtype single_sign_on_state: str or ~azure.mgmt.dynatrace.models.SingleSignOnStates + :keyword enterprise_app_id: Version of the Dynatrace agent installed on the VM. + :paramtype enterprise_app_id: str + :keyword single_sign_on_url: The login URL specific to this Dynatrace Environment. + :paramtype single_sign_on_url: str + :keyword aad_domains: array of Aad(azure active directory) domains. + :paramtype aad_domains: list[str] + """ + super(DynatraceSingleSignOnResource, self).__init__(**kwargs) + self.system_data = None + self.single_sign_on_state = single_sign_on_state + self.enterprise_app_id = enterprise_app_id + self.single_sign_on_url = single_sign_on_url + self.aad_domains = aad_domains + self.provisioning_state = None + + +class DynatraceSingleSignOnResourceListResult(msrest.serialization.Model): + """The response of a DynatraceSingleSignOnResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DynatraceSingleSignOnResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DynatraceSingleSignOnResource"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(DynatraceSingleSignOnResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class EnvironmentInfo(msrest.serialization.Model): + """Dynatrace Environment Information. + + :ivar environment_id: Id of the environment created. + :vartype environment_id: str + :ivar ingestion_key: Ingestion key of the environment. + :vartype ingestion_key: str + :ivar logs_ingestion_endpoint: Ingestion endpoint used for sending logs. + :vartype logs_ingestion_endpoint: str + :ivar landing_url: Landing URL for Dynatrace environment. + :vartype landing_url: str + """ + + _attribute_map = { + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'ingestion_key': {'key': 'ingestionKey', 'type': 'str'}, + 'logs_ingestion_endpoint': {'key': 'logsIngestionEndpoint', 'type': 'str'}, + 'landing_url': {'key': 'landingURL', 'type': 'str'}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + ingestion_key: Optional[str] = None, + logs_ingestion_endpoint: Optional[str] = None, + landing_url: Optional[str] = None, + **kwargs + ): + """ + :keyword environment_id: Id of the environment created. + :paramtype environment_id: str + :keyword ingestion_key: Ingestion key of the environment. + :paramtype ingestion_key: str + :keyword logs_ingestion_endpoint: Ingestion endpoint used for sending logs. + :paramtype logs_ingestion_endpoint: str + :keyword landing_url: Landing URL for Dynatrace environment. + :paramtype landing_url: str + """ + super(EnvironmentInfo, self).__init__(**kwargs) + self.environment_id = environment_id + self.ingestion_key = ingestion_key + self.logs_ingestion_endpoint = logs_ingestion_endpoint + self.landing_url = landing_url + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.dynatrace.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.dynatrace.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.dynatrace.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.dynatrace.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +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. + + :ivar name: The name (also known as the key) of the tag. + :vartype name: str + :ivar value: The value of the tag. + :vartype value: str + :ivar action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :vartype action: str or ~azure.mgmt.dynatrace.models.TagAction + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + action: Optional[Union[str, "TagAction"]] = None, + **kwargs + ): + """ + :keyword name: The name (also known as the key) of the tag. + :paramtype name: str + :keyword value: The value of the tag. + :paramtype value: str + :keyword action: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + Possible values include: "Include", "Exclude". + :paramtype action: str or ~azure.mgmt.dynatrace.models.TagAction + """ + super(FilteringTag, self).__init__(**kwargs) + self.name = name + self.value = value + self.action = action + + +class IdentityProperties(msrest.serialization.Model): + """The properties of the managed service identities assigned to this 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 tenant_id: The Active Directory tenant id of the principal. + :vartype tenant_id: str + :ivar principal_id: The active directory identifier of this principal. + :vartype principal_id: str + :ivar type: Required. The type of managed identity assigned to this resource. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". + :vartype type: str or ~azure.mgmt.dynatrace.models.ManagedIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.dynatrace.models.UserAssignedIdentity] + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. The type of managed identity assigned to this resource. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAndUserAssigned". + :paramtype type: str or ~azure.mgmt.dynatrace.models.ManagedIdentityType + :keyword user_assigned_identities: The identities assigned to this resource by the user. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.dynatrace.models.UserAssignedIdentity] + """ + super(IdentityProperties, self).__init__(**kwargs) + self.tenant_id = None + self.principal_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class LinkableEnvironmentListResponse(msrest.serialization.Model): + """Response for getting all the linkable environments. + + :ivar value: List of environments for which user is an admin. + :vartype value: list[~azure.mgmt.dynatrace.models.LinkableEnvironmentResponse] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LinkableEnvironmentResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["LinkableEnvironmentResponse"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: List of environments for which user is an admin. + :paramtype value: list[~azure.mgmt.dynatrace.models.LinkableEnvironmentResponse] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ + super(LinkableEnvironmentListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LinkableEnvironmentRequest(msrest.serialization.Model): + """Request for getting all the linkable environments for a user. + + :ivar tenant_id: Tenant Id of the user in which they want to link the environment. + :vartype tenant_id: str + :ivar user_principal: user principal id of the user. + :vartype user_principal: str + :ivar region: Azure region in which we want to link the environment. + :vartype region: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_principal': {'key': 'userPrincipal', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + user_principal: Optional[str] = None, + region: Optional[str] = None, + **kwargs + ): + """ + :keyword tenant_id: Tenant Id of the user in which they want to link the environment. + :paramtype tenant_id: str + :keyword user_principal: user principal id of the user. + :paramtype user_principal: str + :keyword region: Azure region in which we want to link the environment. + :paramtype region: str + """ + super(LinkableEnvironmentRequest, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.user_principal = user_principal + self.region = region + + +class LinkableEnvironmentResponse(msrest.serialization.Model): + """Response for getting all the linkable environments. + + :ivar environment_id: environment id for which user is an admin. + :vartype environment_id: str + :ivar environment_name: Name of the environment. + :vartype environment_name: str + :ivar plan_data: Billing plan information. + :vartype plan_data: ~azure.mgmt.dynatrace.models.PlanData + """ + + _attribute_map = { + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_name': {'key': 'environmentName', 'type': 'str'}, + 'plan_data': {'key': 'planData', 'type': 'PlanData'}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + environment_name: Optional[str] = None, + plan_data: Optional["PlanData"] = None, + **kwargs + ): + """ + :keyword environment_id: environment id for which user is an admin. + :paramtype environment_id: str + :keyword environment_name: Name of the environment. + :paramtype environment_name: str + :keyword plan_data: Billing plan information. + :paramtype plan_data: ~azure.mgmt.dynatrace.models.PlanData + """ + super(LinkableEnvironmentResponse, self).__init__(**kwargs) + self.environment_id = environment_id + self.environment_name = environment_name + self.plan_data = plan_data + + +class LogRules(msrest.serialization.Model): + """Set of rules for sending logs for the Monitor resource. + + :ivar send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + Possible values include: "Enabled", "Disabled". + :vartype send_aad_logs: str or ~azure.mgmt.dynatrace.models.SendAadLogsStatus + :ivar send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. Possible values include: "Enabled", "Disabled". + :vartype send_subscription_logs: str or ~azure.mgmt.dynatrace.models.SendSubscriptionLogsStatus + :ivar send_activity_logs: Flag specifying if activity logs from Azure resources should be sent + for the Monitor resource. Possible values include: "Enabled", "Disabled". + :vartype send_activity_logs: str or ~azure.mgmt.dynatrace.models.SendActivityLogsStatus + :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. + :vartype filtering_tags: list[~azure.mgmt.dynatrace.models.FilteringTag] + """ + + _attribute_map = { + 'send_aad_logs': {'key': 'sendAadLogs', 'type': 'str'}, + 'send_subscription_logs': {'key': 'sendSubscriptionLogs', 'type': 'str'}, + 'send_activity_logs': {'key': 'sendActivityLogs', 'type': 'str'}, + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + send_aad_logs: Optional[Union[str, "SendAadLogsStatus"]] = None, + send_subscription_logs: Optional[Union[str, "SendSubscriptionLogsStatus"]] = None, + send_activity_logs: Optional[Union[str, "SendActivityLogsStatus"]] = None, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + """ + :keyword send_aad_logs: Flag specifying if AAD logs should be sent for the Monitor resource. + Possible values include: "Enabled", "Disabled". + :paramtype send_aad_logs: str or ~azure.mgmt.dynatrace.models.SendAadLogsStatus + :keyword send_subscription_logs: Flag specifying if subscription logs should be sent for the + Monitor resource. Possible values include: "Enabled", "Disabled". + :paramtype send_subscription_logs: str or + ~azure.mgmt.dynatrace.models.SendSubscriptionLogsStatus + :keyword send_activity_logs: Flag specifying if activity logs from Azure resources should be + sent for the Monitor resource. Possible values include: "Enabled", "Disabled". + :paramtype send_activity_logs: str or ~azure.mgmt.dynatrace.models.SendActivityLogsStatus + :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.dynatrace.models.FilteringTag] + """ + super(LogRules, self).__init__(**kwargs) + self.send_aad_logs = send_aad_logs + self.send_subscription_logs = send_subscription_logs + self.send_activity_logs = send_activity_logs + self.filtering_tags = filtering_tags + + +class MetricRules(msrest.serialization.Model): + """Set of rules for sending metrics for the Monitor resource. + + :ivar filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :vartype filtering_tags: list[~azure.mgmt.dynatrace.models.FilteringTag] + """ + + _attribute_map = { + 'filtering_tags': {'key': 'filteringTags', 'type': '[FilteringTag]'}, + } + + def __init__( + self, + *, + filtering_tags: Optional[List["FilteringTag"]] = None, + **kwargs + ): + """ + :keyword filtering_tags: List of filtering tags to be used for capturing metrics. If empty, all + resources will be captured. If only Exclude action is specified, the rules will apply to the + list of all available resources. If Include actions are specified, the rules will only include + resources with the associated tags. + :paramtype filtering_tags: list[~azure.mgmt.dynatrace.models.FilteringTag] + """ + super(MetricRules, self).__init__(**kwargs) + self.filtering_tags = filtering_tags + + +class MonitoredResource(msrest.serialization.Model): + """Details of resource being monitored by Dynatrace monitor resource. + + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Possible + values include: "Enabled", "Disabled". + :vartype sending_metrics: str or ~azure.mgmt.dynatrace.models.SendingMetricsStatus + :ivar reason_for_metrics_status: Reason for why the resource is sending metrics (or why it is + not sending). + :vartype reason_for_metrics_status: str + :ivar sending_logs: Flag indicating if resource is sending logs to Dynatrace. Possible values + include: "Enabled", "Disabled". + :vartype sending_logs: str or ~azure.mgmt.dynatrace.models.SendingLogsStatus + :ivar reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :vartype reason_for_logs_status: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sending_metrics': {'key': 'sendingMetrics', 'type': 'str'}, + 'reason_for_metrics_status': {'key': 'reasonForMetricsStatus', 'type': 'str'}, + 'sending_logs': {'key': 'sendingLogs', 'type': 'str'}, + 'reason_for_logs_status': {'key': 'reasonForLogsStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + sending_metrics: Optional[Union[str, "SendingMetricsStatus"]] = None, + reason_for_metrics_status: Optional[str] = None, + sending_logs: Optional[Union[str, "SendingLogsStatus"]] = None, + reason_for_logs_status: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The ARM id of the resource. + :paramtype id: str + :keyword sending_metrics: Flag indicating if resource is sending metrics to Dynatrace. Possible + values include: "Enabled", "Disabled". + :paramtype sending_metrics: str or ~azure.mgmt.dynatrace.models.SendingMetricsStatus + :keyword reason_for_metrics_status: Reason for why the resource is sending metrics (or why it + is not sending). + :paramtype reason_for_metrics_status: str + :keyword sending_logs: Flag indicating if resource is sending logs to Dynatrace. Possible + values include: "Enabled", "Disabled". + :paramtype sending_logs: str or ~azure.mgmt.dynatrace.models.SendingLogsStatus + :keyword reason_for_logs_status: Reason for why the resource is sending logs (or why it is not + sending). + :paramtype reason_for_logs_status: str + """ + super(MonitoredResource, self).__init__(**kwargs) + self.id = id + self.sending_metrics = sending_metrics + self.reason_for_metrics_status = reason_for_metrics_status + self.sending_logs = sending_logs + self.reason_for_logs_status = reason_for_logs_status + + +class MonitoredResourceListResponse(msrest.serialization.Model): + """List of all the resources being monitored by Dynatrace monitor resource. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.MonitoredResource] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitoredResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["MonitoredResource"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.MonitoredResource] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(MonitoredResourceListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class MonitorResource(TrackedResource): + """Dynatrace 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar system_data: System metadata for this resource. + :vartype system_data: ~azure.mgmt.dynatrace.models.SystemData + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.dynatrace.models.IdentityProperties + :ivar monitoring_status: Status of the monitor. Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus + :ivar marketplace_subscription_status: Marketplace subscription status. Possible values + include: "Active", "Suspended". + :vartype marketplace_subscription_status: str or + ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus + :ivar dynatrace_environment_properties: Properties of the Dynatrace environment. + :vartype dynatrace_environment_properties: + ~azure.mgmt.dynatrace.models.DynatraceEnvironmentProperties + :ivar user_info: User info. + :vartype user_info: ~azure.mgmt.dynatrace.models.UserInfo + :ivar plan_data: Billing plan information. + :vartype plan_data: ~azure.mgmt.dynatrace.models.PlanData + :ivar liftr_resource_category: Liftr Resource category. Possible values include: "Unknown", + "MonitorLogs". + :vartype liftr_resource_category: str or ~azure.mgmt.dynatrace.models.LiftrResourceCategories + :ivar liftr_resource_preference: The priority of the resource. + :vartype liftr_resource_preference: int + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'liftr_resource_category': {'readonly': True}, + 'liftr_resource_preference': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'IdentityProperties'}, + 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'properties.marketplaceSubscriptionStatus', 'type': 'str'}, + 'dynatrace_environment_properties': {'key': 'properties.dynatraceEnvironmentProperties', 'type': 'DynatraceEnvironmentProperties'}, + 'user_info': {'key': 'properties.userInfo', 'type': 'UserInfo'}, + 'plan_data': {'key': 'properties.planData', 'type': 'PlanData'}, + 'liftr_resource_category': {'key': 'properties.liftrResourceCategory', 'type': 'str'}, + 'liftr_resource_preference': {'key': 'properties.liftrResourcePreference', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["IdentityProperties"] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, + marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, + dynatrace_environment_properties: Optional["DynatraceEnvironmentProperties"] = None, + user_info: Optional["UserInfo"] = None, + plan_data: Optional["PlanData"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.dynatrace.models.IdentityProperties + :keyword monitoring_status: Status of the monitor. Possible values include: "Enabled", + "Disabled". + :paramtype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus + :keyword marketplace_subscription_status: Marketplace subscription status. Possible values + include: "Active", "Suspended". + :paramtype marketplace_subscription_status: str or + ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus + :keyword dynatrace_environment_properties: Properties of the Dynatrace environment. + :paramtype dynatrace_environment_properties: + ~azure.mgmt.dynatrace.models.DynatraceEnvironmentProperties + :keyword user_info: User info. + :paramtype user_info: ~azure.mgmt.dynatrace.models.UserInfo + :keyword plan_data: Billing plan information. + :paramtype plan_data: ~azure.mgmt.dynatrace.models.PlanData + """ + super(MonitorResource, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.identity = identity + self.monitoring_status = monitoring_status + self.marketplace_subscription_status = marketplace_subscription_status + self.dynatrace_environment_properties = dynatrace_environment_properties + self.user_info = user_info + self.plan_data = plan_data + self.liftr_resource_category = None + self.liftr_resource_preference = None + self.provisioning_state = None + + +class MonitorResourceListResult(msrest.serialization.Model): + """The response of a MonitorResource list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.MonitorResource] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MonitorResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["MonitorResource"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.MonitorResource] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(MonitorResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MonitorResourceUpdate(msrest.serialization.Model): + """The updatable properties of the MonitorResource. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar monitoring_status: Status of the monitor. Possible values include: "Enabled", "Disabled". + :vartype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus + :ivar marketplace_subscription_status: Marketplace subscription status. Possible values + include: "Active", "Suspended". + :vartype marketplace_subscription_status: str or + ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus + :ivar dynatrace_environment_properties: Properties of the Dynatrace environment. + :vartype dynatrace_environment_properties: + ~azure.mgmt.dynatrace.models.DynatraceEnvironmentProperties + :ivar user_info: User info. + :vartype user_info: ~azure.mgmt.dynatrace.models.UserInfo + :ivar plan_data: Billing plan information. + :vartype plan_data: ~azure.mgmt.dynatrace.models.PlanData + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'monitoring_status': {'key': 'monitoringStatus', 'type': 'str'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'dynatrace_environment_properties': {'key': 'dynatraceEnvironmentProperties', 'type': 'DynatraceEnvironmentProperties'}, + 'user_info': {'key': 'userInfo', 'type': 'UserInfo'}, + 'plan_data': {'key': 'planData', 'type': 'PlanData'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + monitoring_status: Optional[Union[str, "MonitoringStatus"]] = None, + marketplace_subscription_status: Optional[Union[str, "MarketplaceSubscriptionStatus"]] = None, + dynatrace_environment_properties: Optional["DynatraceEnvironmentProperties"] = None, + user_info: Optional["UserInfo"] = None, + plan_data: Optional["PlanData"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword monitoring_status: Status of the monitor. Possible values include: "Enabled", + "Disabled". + :paramtype monitoring_status: str or ~azure.mgmt.dynatrace.models.MonitoringStatus + :keyword marketplace_subscription_status: Marketplace subscription status. Possible values + include: "Active", "Suspended". + :paramtype marketplace_subscription_status: str or + ~azure.mgmt.dynatrace.models.MarketplaceSubscriptionStatus + :keyword dynatrace_environment_properties: Properties of the Dynatrace environment. + :paramtype dynatrace_environment_properties: + ~azure.mgmt.dynatrace.models.DynatraceEnvironmentProperties + :keyword user_info: User info. + :paramtype user_info: ~azure.mgmt.dynatrace.models.UserInfo + :keyword plan_data: Billing plan information. + :paramtype plan_data: ~azure.mgmt.dynatrace.models.PlanData + """ + super(MonitorResourceUpdate, self).__init__(**kwargs) + self.tags = tags + self.monitoring_status = monitoring_status + self.marketplace_subscription_status = marketplace_subscription_status + self.dynatrace_environment_properties = dynatrace_environment_properties + self.user_info = user_info + self.plan_data = plan_data + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.dynatrace.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.dynatrace.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.dynatrace.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.dynatrace.models.OperationDisplay + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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 = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.dynatrace.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PlanData(msrest.serialization.Model): + """Billing plan information. + + :ivar usage_type: different usage type like PAYG/COMMITTED. this could be enum. + :vartype usage_type: str + :ivar billing_cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum. + :vartype billing_cycle: str + :ivar plan_details: plan id as published by Dynatrace. + :vartype plan_details: str + :ivar effective_date: date when plan was applied. + :vartype effective_date: ~datetime.datetime + """ + + _validation = { + 'usage_type': {'max_length': 50, 'min_length': 0}, + 'billing_cycle': {'max_length': 50, 'min_length': 0}, + 'plan_details': {'max_length': 50, 'min_length': 0}, + } + + _attribute_map = { + 'usage_type': {'key': 'usageType', 'type': 'str'}, + 'billing_cycle': {'key': 'billingCycle', 'type': 'str'}, + 'plan_details': {'key': 'planDetails', 'type': 'str'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + usage_type: Optional[str] = None, + billing_cycle: Optional[str] = None, + plan_details: Optional[str] = None, + effective_date: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword usage_type: different usage type like PAYG/COMMITTED. this could be enum. + :paramtype usage_type: str + :keyword billing_cycle: different billing cycles like MONTHLY/WEEKLY. this could be enum. + :paramtype billing_cycle: str + :keyword plan_details: plan id as published by Dynatrace. + :paramtype plan_details: str + :keyword effective_date: date when plan was applied. + :paramtype effective_date: ~datetime.datetime + """ + super(PlanData, self).__init__(**kwargs) + self.usage_type = usage_type + self.billing_cycle = billing_cycle + self.plan_details = plan_details + self.effective_date = effective_date + + +class SSODetailsRequest(msrest.serialization.Model): + """Request for getting sso details for a user. + + :ivar user_principal: user principal id of the user. + :vartype user_principal: str + """ + + _attribute_map = { + 'user_principal': {'key': 'userPrincipal', 'type': 'str'}, + } + + def __init__( + self, + *, + user_principal: Optional[str] = None, + **kwargs + ): + """ + :keyword user_principal: user principal id of the user. + :paramtype user_principal: str + """ + super(SSODetailsRequest, self).__init__(**kwargs) + self.user_principal = user_principal + + +class SSODetailsResponse(msrest.serialization.Model): + """SSO details from the Dynatrace partner. + + :ivar is_sso_enabled: Whether the SSO is enabled for this resource or not. Possible values + include: "Enabled", "Disabled". + :vartype is_sso_enabled: str or ~azure.mgmt.dynatrace.models.SSOStatus + :ivar metadata_url: URL for Azure AD metadata. + :vartype metadata_url: str + :ivar single_sign_on_url: The login URL specific to this Dynatrace Environment. + :vartype single_sign_on_url: str + :ivar aad_domains: array of Aad(azure active directory) domains. + :vartype aad_domains: list[str] + :ivar admin_users: Array of admin user emails. + :vartype admin_users: list[str] + """ + + _attribute_map = { + 'is_sso_enabled': {'key': 'isSsoEnabled', 'type': 'str'}, + 'metadata_url': {'key': 'metadataUrl', 'type': 'str'}, + 'single_sign_on_url': {'key': 'singleSignOnUrl', 'type': 'str'}, + 'aad_domains': {'key': 'aadDomains', 'type': '[str]'}, + 'admin_users': {'key': 'adminUsers', 'type': '[str]'}, + } + + def __init__( + self, + *, + is_sso_enabled: Optional[Union[str, "SSOStatus"]] = None, + metadata_url: Optional[str] = None, + single_sign_on_url: Optional[str] = None, + aad_domains: Optional[List[str]] = None, + admin_users: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword is_sso_enabled: Whether the SSO is enabled for this resource or not. Possible values + include: "Enabled", "Disabled". + :paramtype is_sso_enabled: str or ~azure.mgmt.dynatrace.models.SSOStatus + :keyword metadata_url: URL for Azure AD metadata. + :paramtype metadata_url: str + :keyword single_sign_on_url: The login URL specific to this Dynatrace Environment. + :paramtype single_sign_on_url: str + :keyword aad_domains: array of Aad(azure active directory) domains. + :paramtype aad_domains: list[str] + :keyword admin_users: Array of admin user emails. + :paramtype admin_users: list[str] + """ + super(SSODetailsResponse, self).__init__(**kwargs) + self.is_sso_enabled = is_sso_enabled + self.metadata_url = metadata_url + self.single_sign_on_url = single_sign_on_url + self.aad_domains = aad_domains + self.admin_users = admin_users + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :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.dynatrace.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". + :vartype last_modified_by_type: str or ~azure.mgmt.dynatrace.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype 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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + 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.dynatrace.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.dynatrace.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 + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagRule(ProxyResource): + """Tag rules for a monitor resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: System metadata for this resource. + :vartype system_data: ~azure.mgmt.dynatrace.models.SystemData + :ivar log_rules: Set of rules for sending logs for the Monitor resource. + :vartype log_rules: ~azure.mgmt.dynatrace.models.LogRules + :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. + :vartype metric_rules: ~azure.mgmt.dynatrace.models.MetricRules + :ivar provisioning_state: Provisioning state of the resource. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :vartype provisioning_state: str or ~azure.mgmt.dynatrace.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'log_rules': {'key': 'properties.logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'properties.metricRules', 'type': 'MetricRules'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + log_rules: Optional["LogRules"] = None, + metric_rules: Optional["MetricRules"] = None, + **kwargs + ): + """ + :keyword log_rules: Set of rules for sending logs for the Monitor resource. + :paramtype log_rules: ~azure.mgmt.dynatrace.models.LogRules + :keyword metric_rules: Set of rules for sending metrics for the Monitor resource. + :paramtype metric_rules: ~azure.mgmt.dynatrace.models.MetricRules + """ + super(TagRule, self).__init__(**kwargs) + self.system_data = None + self.log_rules = log_rules + self.metric_rules = metric_rules + self.provisioning_state = None + + +class TagRuleListResult(msrest.serialization.Model): + """The response of a TagRule list operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.TagRule] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["TagRule"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.TagRule] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(TagRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TagRuleUpdate(msrest.serialization.Model): + """The updatable properties of the TagRule. + + :ivar log_rules: Set of rules for sending logs for the Monitor resource. + :vartype log_rules: ~azure.mgmt.dynatrace.models.LogRules + :ivar metric_rules: Set of rules for sending metrics for the Monitor resource. + :vartype metric_rules: ~azure.mgmt.dynatrace.models.MetricRules + """ + + _attribute_map = { + 'log_rules': {'key': 'logRules', 'type': 'LogRules'}, + 'metric_rules': {'key': 'metricRules', 'type': 'MetricRules'}, + } + + def __init__( + self, + *, + log_rules: Optional["LogRules"] = None, + metric_rules: Optional["MetricRules"] = None, + **kwargs + ): + """ + :keyword log_rules: Set of rules for sending logs for the Monitor resource. + :paramtype log_rules: ~azure.mgmt.dynatrace.models.LogRules + :keyword metric_rules: Set of rules for sending metrics for the Monitor resource. + :paramtype metric_rules: ~azure.mgmt.dynatrace.models.MetricRules + """ + super(TagRuleUpdate, self).__init__(**kwargs) + self.log_rules = log_rules + self.metric_rules = metric_rules + + +class UserAssignedIdentity(msrest.serialization.Model): + """A managed identity assigned by the user. + + All required parameters must be populated in order to send to Azure. + + :ivar client_id: Required. The active directory client identifier for this principal. + :vartype client_id: str + :ivar principal_id: Required. The active directory identifier for this principal. + :vartype principal_id: str + """ + + _validation = { + 'client_id': {'required': True}, + 'principal_id': {'required': True}, + } + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: str, + principal_id: str, + **kwargs + ): + """ + :keyword client_id: Required. The active directory client identifier for this principal. + :paramtype client_id: str + :keyword principal_id: Required. The active directory identifier for this principal. + :paramtype principal_id: str + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.client_id = client_id + self.principal_id = principal_id + + +class UserInfo(msrest.serialization.Model): + """User info. + + :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 email_address: Email of the user used by Dynatrace for contacting them if needed. + :vartype email_address: str + :ivar phone_number: Phone number of the user used by Dynatrace for contacting them if needed. + :vartype phone_number: str + :ivar country: Country of the user. + :vartype country: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$'}, + 'phone_number': {'max_length': 40, 'min_length': 0}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone_number: Optional[str] = None, + country: Optional[str] = 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 email_address: Email of the user used by Dynatrace for contacting them if needed. + :paramtype email_address: str + :keyword phone_number: Phone number of the user used by Dynatrace for contacting them if + needed. + :paramtype phone_number: str + :keyword country: Country of the user. + :paramtype country: str + """ + super(UserInfo, self).__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + self.phone_number = phone_number + self.country = country + + +class VMExtensionPayload(msrest.serialization.Model): + """Response of payload to be passed while installing VM agent. + + :ivar ingestion_key: Ingestion key of the environment. + :vartype ingestion_key: str + :ivar environment_id: Id of the environment created. + :vartype environment_id: str + """ + + _attribute_map = { + 'ingestion_key': {'key': 'ingestionKey', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + } + + def __init__( + self, + *, + ingestion_key: Optional[str] = None, + environment_id: Optional[str] = None, + **kwargs + ): + """ + :keyword ingestion_key: Ingestion key of the environment. + :paramtype ingestion_key: str + :keyword environment_id: Id of the environment created. + :paramtype environment_id: str + """ + super(VMExtensionPayload, self).__init__(**kwargs) + self.ingestion_key = ingestion_key + self.environment_id = environment_id + + +class VMHostsListResponse(msrest.serialization.Model): + """Response of a list VM Host Operation. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The items on this page. + :vartype value: list[~azure.mgmt.dynatrace.models.VMInfo] + :ivar next_link: Required. The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VMInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VMInfo"], + next_link: str, + **kwargs + ): + """ + :keyword value: Required. The items on this page. + :paramtype value: list[~azure.mgmt.dynatrace.models.VMInfo] + :keyword next_link: Required. The link to the next page of items. + :paramtype next_link: str + """ + super(VMHostsListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VMInfo(msrest.serialization.Model): + """Details of VM Resource having Dynatrace OneAgent installed. + + :ivar resource_id: Azure VM resource ID. + :vartype resource_id: str + :ivar version: Version of the Dynatrace agent installed on the VM. + :vartype version: str + :ivar monitoring_type: The monitoring mode of OneAgent. Possible values include: + "CLOUD_INFRASTRUCTURE", "FULL_STACK". + :vartype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType + :ivar auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + "DISABLED". + :vartype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting + :ivar update_status: The current update status of OneAgent. Possible values include: + "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", + "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :vartype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus + :ivar availability_state: The availability state of OneAgent. Possible values include: + "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + "UNMONITORED". + :vartype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState + :ivar log_module: Tells whether log modules are enabled or not. Possible values include: + "ENABLED", "DISABLED". + :vartype log_module: str or ~azure.mgmt.dynatrace.models.LogModule + :ivar host_group: The name of the host group. + :vartype host_group: str + :ivar host_name: The name of the host. + :vartype host_name: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'monitoring_type': {'key': 'monitoringType', 'type': 'str'}, + 'auto_update_setting': {'key': 'autoUpdateSetting', 'type': 'str'}, + 'update_status': {'key': 'updateStatus', 'type': 'str'}, + 'availability_state': {'key': 'availabilityState', 'type': 'str'}, + 'log_module': {'key': 'logModule', 'type': 'str'}, + 'host_group': {'key': 'hostGroup', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + version: Optional[str] = None, + monitoring_type: Optional[Union[str, "MonitoringType"]] = None, + auto_update_setting: Optional[Union[str, "AutoUpdateSetting"]] = None, + update_status: Optional[Union[str, "UpdateStatus"]] = None, + availability_state: Optional[Union[str, "AvailabilityState"]] = None, + log_module: Optional[Union[str, "LogModule"]] = None, + host_group: Optional[str] = None, + host_name: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: Azure VM resource ID. + :paramtype resource_id: str + :keyword version: Version of the Dynatrace agent installed on the VM. + :paramtype version: str + :keyword monitoring_type: The monitoring mode of OneAgent. Possible values include: + "CLOUD_INFRASTRUCTURE", "FULL_STACK". + :paramtype monitoring_type: str or ~azure.mgmt.dynatrace.models.MonitoringType + :keyword auto_update_setting: Update settings of OneAgent. Possible values include: "ENABLED", + "DISABLED". + :paramtype auto_update_setting: str or ~azure.mgmt.dynatrace.models.AutoUpdateSetting + :keyword update_status: The current update status of OneAgent. Possible values include: + "INCOMPATIBLE", "OUTDATED", "SCHEDULED", "SUPPRESSED", "UNKNOWN", "UP2DATE", + "UPDATE_IN_PROGRESS", "UPDATE_PENDING", "UPDATE_PROBLEM". + :paramtype update_status: str or ~azure.mgmt.dynatrace.models.UpdateStatus + :keyword availability_state: The availability state of OneAgent. Possible values include: + "CRASHED", "LOST", "MONITORED", "PRE_MONITORED", "SHUTDOWN", "UNEXPECTED_SHUTDOWN", "UNKNOWN", + "UNMONITORED". + :paramtype availability_state: str or ~azure.mgmt.dynatrace.models.AvailabilityState + :keyword log_module: Tells whether log modules are enabled or not. Possible values include: + "ENABLED", "DISABLED". + :paramtype log_module: str or ~azure.mgmt.dynatrace.models.LogModule + :keyword host_group: The name of the host group. + :paramtype host_group: str + :keyword host_name: The name of the host. + :paramtype host_name: str + """ + super(VMInfo, self).__init__(**kwargs) + self.resource_id = resource_id + self.version = version + self.monitoring_type = monitoring_type + self.auto_update_setting = auto_update_setting + self.update_status = update_status + self.availability_state = availability_state + self.log_module = log_module + self.host_group = host_group + self.host_name = host_name diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py new file mode 100644 index 000000000000..8fbbc8d96450 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/__init__.py @@ -0,0 +1,19 @@ +# 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 ._monitors_operations import MonitorsOperations +from ._operations import Operations +from ._tag_rules_operations import TagRulesOperations +from ._single_sign_on_operations import SingleSignOnOperations + +__all__ = [ + 'MonitorsOperations', + 'Operations', + 'TagRulesOperations', + 'SingleSignOnOperations', +] diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py new file mode 100644 index 000000000000..25a23c718a1b --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_monitors_operations.py @@ -0,0 +1,1610 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 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 .. import models as _models +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_get_account_credentials_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getAccountCredentials") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_monitored_resources_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_vm_host_payload_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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 = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_subscription_id_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _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_hosts_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_app_services_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_sso_details_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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 + ) + + +def build_list_linkable_environments_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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 MonitorsOperations(object): + """MonitorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_account_credentials( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.AccountInfoSecure": + """Gets the user account credentials for a Monitor. + + Gets the user account credentials for a Monitor. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountInfoSecure, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.AccountInfoSecure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountInfoSecure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_account_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get_account_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccountInfoSecure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getAccountCredentials"} # type: ignore + + + @distributed_trace + def list_monitored_resources( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitoredResourceListResponse"]: + """List the resources currently being monitored by the Dynatrace monitor resource. + + List the resources currently being monitored by the Dynatrace monitor resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitoredResourceListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitoredResourceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoredResourceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_monitored_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_monitored_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_monitored_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources"} # type: ignore + + @distributed_trace + def get_vm_host_payload( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.VMExtensionPayload": + """Returns the payload that needs to be passed in the request body for installing Dynatrace agent + on a VM. + + Returns the payload that needs to be passed in the request body for installing Dynatrace agent + on a VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VMExtensionPayload, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.VMExtensionPayload + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMExtensionPayload"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_vm_host_payload_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get_vm_host_payload.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VMExtensionPayload', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_vm_host_payload.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> "_models.MonitorResource": + """Get a MonitorResource. + + Get a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitorResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.MonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResource", + **kwargs: Any + ) -> "_models.MonitorResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'MonitorResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResource", + **kwargs: Any + ) -> LROPoller["_models.MonitorResource"]: + """Create a MonitorResource. + + Create a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.MonitorResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitorResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.MonitorResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitorResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + monitor_name: str, + resource: "_models.MonitorResourceUpdate", + **kwargs: Any + ) -> "_models.MonitorResource": + """Update a MonitorResource. + + Update a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param resource: The resource properties to be updated. + :type resource: ~azure.mgmt.dynatrace.models.MonitorResourceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitorResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.MonitorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'MonitorResourceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a MonitorResource. + + Delete a MonitorResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"} # type: ignore + + @distributed_trace + def list_by_subscription_id( + self, + **kwargs: Any + ) -> Iterable["_models.MonitorResourceListResult"]: + """List all MonitorResource by subscriptionId. + + List all MonitorResource by subscriptionId. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorResourceListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("MonitorResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription_id.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MonitorResourceListResult"]: + """List MonitorResource resources by resource group. + + List MonitorResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MonitorResourceListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitorResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + 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("MonitorResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors"} # type: ignore + + @distributed_trace + def list_hosts( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.VMHostsListResponse"]: + """List the compute resources currently being monitored by the Dynatrace resource. + + List the compute resources currently being monitored by the Dynatrace resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VMHostsListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.VMHostsListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.VMHostsListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_hosts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("VMHostsListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts"} # type: ignore + + @distributed_trace + def list_app_services( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.AppServiceListResponse"]: + """Gets list of App Services with Dynatrace PaaS OneAgent enabled. + + Gets list of App Services with Dynatrace PaaS OneAgent enabled. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppServiceListResponse or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.AppServiceListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppServiceListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_app_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list_app_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_app_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("AppServiceListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_app_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices"} # type: ignore + + @distributed_trace + def get_sso_details( + self, + resource_group_name: str, + monitor_name: str, + request: Optional["_models.SSODetailsRequest"] = None, + **kwargs: Any + ) -> "_models.SSODetailsResponse": + """Gets the SSO configuration details from the partner. + + Gets the SSO configuration details from the partner. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param request: The details of the get sso details request. Default value is None. + :type request: ~azure.mgmt.dynatrace.models.SSODetailsRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SSODetailsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SSODetailsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if request is not None: + _json = self._serialize.body(request, 'SSODetailsRequest') + else: + _json = None + + request = build_get_sso_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.get_sso_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SSODetailsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sso_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails"} # type: ignore + + + @distributed_trace + def list_linkable_environments( + self, + resource_group_name: str, + monitor_name: str, + request: "_models.LinkableEnvironmentRequest", + **kwargs: Any + ) -> Iterable["_models.LinkableEnvironmentListResponse"]: + """Gets all the Dynatrace environments that a user can link a azure resource to. + + Gets all the Dynatrace environments that a user can link a azure resource to. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param request: The details of the linkable environment request. + :type request: ~azure.mgmt.dynatrace.models.LinkableEnvironmentRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkableEnvironmentListResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkableEnvironmentListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + _json = self._serialize.body(request, 'LinkableEnvironmentRequest') + + request = build_list_linkable_environments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_linkable_environments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + _json = self._serialize.body(request, 'LinkableEnvironmentRequest') + + request = build_list_linkable_environments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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("LinkableEnvironmentListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_linkable_environments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py new file mode 100644 index 000000000000..6057a7c9f295 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +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 = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Dynatrace.Observability/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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """List the operations for Dynatrace.Observability. + + List the operations for Dynatrace.Observability. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Dynatrace.Observability/operations"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py new file mode 100644 index 000000000000..5a72423233b5 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_single_sign_on_operations.py @@ -0,0 +1,458 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 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 .. import models as _models +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_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + _url = _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, + configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + _url = _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_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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 + ) + +class SingleSignOnOperations(object): + """SingleSignOnOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + resource: "_models.DynatraceSingleSignOnResource", + **kwargs: Any + ) -> "_models.DynatraceSingleSignOnResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'DynatraceSingleSignOnResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + resource: "_models.DynatraceSingleSignOnResource", + **kwargs: Any + ) -> LROPoller["_models.DynatraceSingleSignOnResource"]: + """Create a DynatraceSingleSignOnResource. + + Create a DynatraceSingleSignOnResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: Single Sign On Configuration Name. + :type configuration_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DynatraceSingleSignOnResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + configuration_name: str, + **kwargs: Any + ) -> "_models.DynatraceSingleSignOnResource": + """Get a DynatraceSingleSignOnResource. + + Get a DynatraceSingleSignOnResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param configuration_name: Single Sign On Configuration Name. + :type configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DynatraceSingleSignOnResource, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + configuration_name=configuration_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DynatraceSingleSignOnResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.DynatraceSingleSignOnResourceListResult"]: + """List all DynatraceSingleSignOnResource by monitorName. + + List all DynatraceSingleSignOnResource by monitorName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DynatraceSingleSignOnResourceListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.DynatraceSingleSignOnResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DynatraceSingleSignOnResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("DynatraceSingleSignOnResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py new file mode 100644 index 000000000000..27101465a924 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/operations/_tag_rules_operations.py @@ -0,0 +1,722 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +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 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 .. import models as _models +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_get_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "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_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "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_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: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "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="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, + rule_set_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + "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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + monitor_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "monitorName": _SERIALIZER.url("monitor_name", monitor_name, 'str'), + } + + _url = _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 + ) + +class TagRulesOperations(object): + """TagRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.dynatrace.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> "_models.TagRule": + """Get a TagRule. + + Get a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagRule, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.TagRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRule", + **kwargs: Any + ) -> "_models.TagRule": + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'TagRule') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRule", + **kwargs: Any + ) -> LROPoller["_models.TagRule"]: + """Create a TagRule. + + Create a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :param resource: Resource create parameters. + :type resource: ~azure.mgmt.dynatrace.models.TagRule + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either TagRule or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.TagRule] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('TagRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + resource: "_models.TagRuleUpdate", + **kwargs: Any + ) -> "_models.TagRule": + """Update a TagRule. + + Update a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :type rule_set_name: str + :param resource: The resource properties to be updated. + :type resource: ~azure.mgmt.dynatrace.models.TagRuleUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagRule, or the result of cls(response) + :rtype: ~azure.mgmt.dynatrace.models.TagRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'TagRuleUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2021-09-01-preview") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + monitor_name: str, + rule_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a TagRule. + + Delete a TagRule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :param rule_set_name: Monitor resource name. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + monitor_name=monitor_name, + rule_set_name=rule_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + monitor_name: str, + **kwargs: Any + ) -> Iterable["_models.TagRuleListResult"]: + """List all TagRule by monitorName. + + List all TagRule by monitorName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param monitor_name: Monitor resource name. + :type monitor_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.TagRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + monitor_name=monitor_name, + api_version=api_version, + 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("TagRuleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules"} # type: ignore diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/py.typed b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/sdk_packaging.toml b/sdk/dynatrace/azure-mgmt-dynatrace/sdk_packaging.toml new file mode 100644 index 000000000000..920acac92e32 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-dynatrace" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Dynatrace Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/setup.py b/sdk/dynatrace/azure-mgmt-dynatrace/setup.py new file mode 100644 index 000000000000..b4d32d31d451 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/setup.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-dynatrace" +PACKAGE_PPRINT_NAME = "Dynatrace Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/dynatrace/ci.yml b/sdk/dynatrace/ci.yml new file mode 100644 index 000000000000..2fec77282f80 --- /dev/null +++ b/sdk/dynatrace/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/dynatrace/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/dynatrace/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dynatrace + Artifacts: + - name: azure-mgmt-dynatrace + safeName: azuremgmtdynatrace diff --git a/shared_requirements.txt b/shared_requirements.txt index a5c00e7d7037..a08156799259 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -345,5 +345,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-appcontainers msrest>=0.6.21 #override azure-mgmt-appcontainers azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-recoveryservicesbackup azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-dynatrace msrest>=0.6.21 +#override azure-mgmt-dynatrace azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-appplatform azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-compute azure-mgmt-core>=1.3.0,<2.0.0