Skip to content

Commit 3974221

Browse files
authored
code and test (Azure#26270)
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
1 parent 0c7a2aa commit 3974221

34 files changed

+6289
-3250
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.0.0 (2022-09-16)
4+
5+
### Breaking Changes
6+
7+
- Client name is changed from `DynatraceObservability` to `DynatraceObservabilityMgmtClient`
8+
39
## 1.0.0b1 (2022-05-19)
410

511
* Initial Release
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py
67
include LICENSE
8+
include azure/mgmt/dynatrace/py.typed

sdk/dynatrace/azure-mgmt-dynatrace/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Dynatrace Management Client Library.
4-
This package has been tested with Python 3.6+.
4+
This package has been tested with Python 3.7+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313

1414
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
1715

1816
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
1917
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.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"autorest": "3.8.4",
33
"use": [
4-
"@autorest/python@5.13.0",
5-
"@autorest/modelerfour@4.19.3"
4+
"@autorest/python@6.1.6",
5+
"@autorest/modelerfour@4.23.5"
66
],
7-
"commit": "11830d3ce01db4f39a41dc37a86075b125c87fdc",
7+
"commit": "e24bbf6a66cb0a19c072c6f15cee163acbd7acf7",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"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",
9+
"autorest_command": "autorest specification/dynatrace/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.6 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
1010
"readme": "specification/dynatrace/resource-manager/readme.md"
1111
}

sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._dynatrace_observability import DynatraceObservability
9+
from ._dynatrace_observability_mgmt_client import DynatraceObservabilityMgmtClient
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['DynatraceObservability']
1413

15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["DynatraceObservabilityMgmtClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_configuration.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,24 @@
1919
from azure.core.credentials import TokenCredential
2020

2121

22-
class DynatraceObservabilityConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23-
"""Configuration for DynatraceObservability.
22+
class DynatraceObservabilityMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
"""Configuration for DynatraceObservabilityMgmtClient.
2424
2525
Note that all parameters used to create this instance are saved as instance
2626
attributes.
2727
28-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
2929
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3131
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
33-
this default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this
33+
default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

37-
def __init__(
38-
self,
39-
credential: "TokenCredential",
40-
subscription_id: str,
41-
**kwargs: Any
42-
) -> None:
43-
super(DynatraceObservabilityConfiguration, self).__init__(**kwargs)
44-
api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
super(DynatraceObservabilityMgmtClientConfiguration, self).__init__(**kwargs)
39+
api_version = kwargs.pop("api_version", "2021-09-01") # type: str
4540

4641
if credential is None:
4742
raise ValueError("Parameter 'credential' must not be None.")
@@ -51,23 +46,24 @@ def __init__(
5146
self.credential = credential
5247
self.subscription_id = subscription_id
5348
self.api_version = api_version
54-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
55-
kwargs.setdefault('sdk_moniker', 'mgmt-dynatrace/{}'.format(VERSION))
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-dynatrace/{}".format(VERSION))
5651
self._configure(**kwargs)
5752

5853
def _configure(
59-
self,
60-
**kwargs # type: Any
54+
self, **kwargs # type: Any
6155
):
6256
# type: (...) -> None
63-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
64-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
65-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
66-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
67-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
68-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
69-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
70-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
71-
self.authentication_policy = kwargs.get('authentication_policy')
57+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
58+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
59+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
60+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
62+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
63+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
64+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
65+
self.authentication_policy = kwargs.get("authentication_policy")
7266
if self.credential and not self.authentication_policy:
73-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)

sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability.py renamed to sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_dynatrace_observability_mgmt_client.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12-
from msrest import Deserializer, Serializer
13-
1412
from azure.core.rest import HttpRequest, HttpResponse
1513
from azure.mgmt.core import ARMPipelineClient
1614

1715
from . import models
18-
from ._configuration import DynatraceObservabilityConfiguration
16+
from ._configuration import DynatraceObservabilityMgmtClientConfiguration
17+
from ._serialization import Deserializer, Serializer
1918
from .operations import MonitorsOperations, Operations, SingleSignOnOperations, TagRulesOperations
2019

2120
if TYPE_CHECKING:
2221
# pylint: disable=unused-import,ungrouped-imports
2322
from azure.core.credentials import TokenCredential
2423

25-
class DynatraceObservability:
26-
"""DynatraceObservability.
24+
25+
class DynatraceObservabilityMgmtClient: # pylint: disable=client-accepts-api-version-keyword
26+
"""DynatraceObservabilityMgmtClient.
2727
2828
:ivar monitors: MonitorsOperations operations
2929
:vartype monitors: azure.mgmt.dynatrace.operations.MonitorsOperations
@@ -33,14 +33,14 @@ class DynatraceObservability:
3333
:vartype tag_rules: azure.mgmt.dynatrace.operations.TagRulesOperations
3434
:ivar single_sign_on: SingleSignOnOperations operations
3535
:vartype single_sign_on: azure.mgmt.dynatrace.operations.SingleSignOnOperations
36-
:param credential: Credential needed for the client to connect to Azure.
36+
:param credential: Credential needed for the client to connect to Azure. Required.
3737
:type credential: ~azure.core.credentials.TokenCredential
38-
:param subscription_id: The ID of the target subscription.
38+
:param subscription_id: The ID of the target subscription. Required.
3939
:type subscription_id: str
4040
:param base_url: Service URL. Default value is "https://management.azure.com".
4141
:type base_url: str
42-
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
43-
this default value may result in unsupported behavior.
42+
:keyword api_version: Api Version. Default value is "2021-09-01". Note that overriding this
43+
default value may result in unsupported behavior.
4444
:paramtype api_version: str
4545
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4646
Retry-After header is present.
@@ -53,7 +53,9 @@ def __init__(
5353
base_url: str = "https://management.azure.com",
5454
**kwargs: Any
5555
) -> None:
56-
self._config = DynatraceObservabilityConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
56+
self._config = DynatraceObservabilityMgmtClientConfiguration(
57+
credential=credential, subscription_id=subscription_id, **kwargs
58+
)
5759
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
5860

5961
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
@@ -65,12 +67,7 @@ def __init__(
6567
self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize)
6668
self.single_sign_on = SingleSignOnOperations(self._client, self._config, self._serialize, self._deserialize)
6769

68-
69-
def _send_request(
70-
self,
71-
request: HttpRequest,
72-
**kwargs: Any
73-
) -> HttpResponse:
70+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7471
"""Runs the network request through the client's chained policies.
7572
7673
>>> from azure.core.rest import HttpRequest
@@ -79,7 +76,7 @@ def _send_request(
7976
>>> response = client._send_request(request)
8077
<HttpResponse: 200 OK>
8178
82-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
79+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
8380
8481
:param request: The network request you want to make. Required.
8582
:type request: ~azure.core.rest.HttpRequest
@@ -97,7 +94,7 @@ def close(self):
9794
self._client.close()
9895

9996
def __enter__(self):
100-
# type: () -> DynatraceObservability
97+
# type: () -> DynatraceObservabilityMgmtClient
10198
self._client.__enter__()
10299
return self
103100

sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_metadata.json

Lines changed: 0 additions & 105 deletions
This file was deleted.

sdk/dynatrace/azure-mgmt-dynatrace/azure/mgmt/dynatrace/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
# This file is used for handwritten extensions to the generated code. Example:
2929
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3030
def patch_sdk():
31-
pass
31+
pass

0 commit comments

Comments
 (0)