1# coding=utf-8
2# --------------------------------------------------------------------------
3# Copyright (c) Microsoft Corporation. All rights reserved.
4# Licensed under the MIT License. See License.txt in the project root for license information.
5# Code generated by Microsoft (R) Python Code Generator.
6# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7# --------------------------------------------------------------------------
8
9from typing import Any, Optional, TYPE_CHECKING
10
11from azure.core.pipeline import policies
12from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
13
14from ._version import VERSION
15
16if TYPE_CHECKING:
17 from azure.core import AzureClouds
18 from azure.core.credentials import TokenCredential
19
20
21class DynatraceObservabilityMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
22 """Configuration for DynatraceObservabilityMgmtClient.
23
24 Note that all parameters used to create this instance are saved as instance
25 attributes.
26
27 :param credential: Credential used to authenticate requests to the service. Required.
28 :type credential: ~azure.core.credentials.TokenCredential
29 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
30 :type subscription_id: str
31 :param base_url: Service host. Default value is "https://management.azure.com".
32 :type base_url: str
33 :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
34 None.
35 :type cloud_setting: ~azure.core.AzureClouds
36 :keyword api_version: The API version to use for this operation. Known values are "2024-04-24"
37 and None. Default value is None. If not set, the operation's default API version will be used.
38 Note that overriding this default value may result in unsupported behavior.
39 :paramtype api_version: str
40 """
41
42 def __init__(
43 self,
44 credential: "TokenCredential",
45 subscription_id: str,
46 base_url: str = "https://management.azure.com",
47 cloud_setting: Optional["AzureClouds"] = None,
48 **kwargs: Any
49 ) -> None:
50 api_version: str = kwargs.pop("api_version", "2024-04-24")
51
52 if credential is None:
53 raise ValueError("Parameter 'credential' must not be None.")
54 if subscription_id is None:
55 raise ValueError("Parameter 'subscription_id' must not be None.")
56
57 self.credential = credential
58 self.subscription_id = subscription_id
59 self.base_url = base_url
60 self.cloud_setting = cloud_setting
61 self.api_version = api_version
62 self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
63 kwargs.setdefault("sdk_moniker", "mgmt-dynatrace/{}".format(VERSION))
64 self.polling_interval = kwargs.get("polling_interval", 30)
65 self._configure(**kwargs)
66
67 def _configure(self, **kwargs: Any) -> None:
68 self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
69 self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
70 self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
71 self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
72 self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
73 self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
74 self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
75 self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
76 self.authentication_policy = kwargs.get("authentication_policy")
77 if self.credential and not self.authentication_policy:
78 self.authentication_policy = ARMChallengeAuthenticationPolicy(
79 self.credential, *self.credential_scopes, **kwargs
80 )