Skip to content

Commit 525b684

Browse files
[AutoRelease] t2-datadog-2023-10-06-51944(can only be merged by SDK owner) (Azure#32355)
* code and test * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com>
1 parent 64627c3 commit 525b684

File tree

62 files changed

+3962
-948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3962
-948
lines changed

sdk/datadog/azure-mgmt-datadog/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release History
22

3+
## 2.1.0 (2023-10-23)
4+
5+
### Features Added
6+
7+
- Added operation group CreationSupportedOperations
8+
- Added operation group MonitoredSubscriptionsOperations
9+
- Model DatadogOrganizationProperties has a new parameter cspm
10+
- Model MonitorUpdateProperties has a new parameter cspm
11+
- Model MonitoringTagRulesProperties has a new parameter automuting
12+
313
## 2.1.0b1 (2022-11-02)
414

515
### Other Changes

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

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,54 @@ For a more complete view of Azure libraries, see the [azure sdk python release](
88

99
_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_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Datadog Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.7+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-datadog
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.datadog import MicrosoftDatadogClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = MicrosoftDatadogClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Datadog Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-datadog%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "0c21115ccacbbad11c4aa13a711e4990ebf07752",
2+
"commit": "75fe114f1abd9d9269591123eb96ac4660e7a095",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.2.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/datadog/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/datadog/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/datadog/resource-manager/readme.md"
1111
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk

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

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

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

1211
from azure.core.configuration import Configuration
@@ -15,11 +14,6 @@
1514

1615
from ._version import VERSION
1716

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2317
if TYPE_CHECKING:
2418
# pylint: disable=unused-import,ungrouped-imports
2519
from azure.core.credentials import TokenCredential
@@ -35,14 +29,14 @@ class MicrosoftDatadogClientConfiguration(Configuration): # pylint: disable=too
3529
:type credential: ~azure.core.credentials.TokenCredential
3630
:param subscription_id: The ID of the target subscription. Required.
3731
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
32+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
3933
default value may result in unsupported behavior.
4034
:paramtype api_version: str
4135
"""
4236

4337
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4438
super(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"]
39+
api_version: str = kwargs.pop("api_version", "2023-01-01")
4640

4741
if credential is None:
4842
raise ValueError("Parameter 'credential' must not be None.")
@@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5650
kwargs.setdefault("sdk_moniker", "mgmt-datadog/{}".format(VERSION))
5751
self._configure(**kwargs)
5852

59-
def _configure(
60-
self, **kwargs # type: Any
61-
):
62-
# type: (...) -> None
53+
def _configure(self, **kwargs: Any) -> None:
6354
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6455
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6556
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)

sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/_microsoft_datadog_client.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
from azure.core.rest import HttpRequest, HttpResponse
1313
from azure.mgmt.core import ARMPipelineClient
1414

15-
from . import models
15+
from . import models as _models
1616
from ._configuration import MicrosoftDatadogClientConfiguration
1717
from ._serialization import Deserializer, Serializer
1818
from .operations import (
19+
CreationSupportedOperations,
1920
MarketplaceAgreementsOperations,
21+
MonitoredSubscriptionsOperations,
2022
MonitorsOperations,
2123
Operations,
2224
SingleSignOnConfigurationsOperations,
@@ -28,11 +30,13 @@
2830
from azure.core.credentials import TokenCredential
2931

3032

31-
class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword
33+
class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3234
"""MicrosoftDatadogClient.
3335
3436
:ivar marketplace_agreements: MarketplaceAgreementsOperations operations
3537
:vartype marketplace_agreements: azure.mgmt.datadog.operations.MarketplaceAgreementsOperations
38+
:ivar creation_supported: CreationSupportedOperations operations
39+
:vartype creation_supported: azure.mgmt.datadog.operations.CreationSupportedOperations
3640
:ivar monitors: MonitorsOperations operations
3741
:vartype monitors: azure.mgmt.datadog.operations.MonitorsOperations
3842
:ivar operations: Operations operations
@@ -42,13 +46,16 @@ class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyw
4246
:ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations
4347
:vartype single_sign_on_configurations:
4448
azure.mgmt.datadog.operations.SingleSignOnConfigurationsOperations
49+
:ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations
50+
:vartype monitored_subscriptions:
51+
azure.mgmt.datadog.operations.MonitoredSubscriptionsOperations
4552
:param credential: Credential needed for the client to connect to Azure. Required.
4653
:type credential: ~azure.core.credentials.TokenCredential
4754
:param subscription_id: The ID of the target subscription. Required.
4855
:type subscription_id: str
4956
:param base_url: Service URL. Default value is "https://management.azure.com".
5057
:type base_url: str
51-
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
58+
:keyword api_version: Api Version. Default value is "2023-01-01". Note that overriding this
5259
default value may result in unsupported behavior.
5360
:paramtype api_version: str
5461
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -65,21 +72,27 @@ def __init__(
6572
self._config = MicrosoftDatadogClientConfiguration(
6673
credential=credential, subscription_id=subscription_id, **kwargs
6774
)
68-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
75+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6976

70-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
77+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
7178
self._serialize = Serializer(client_models)
7279
self._deserialize = Deserializer(client_models)
7380
self._serialize.client_side_validation = False
7481
self.marketplace_agreements = MarketplaceAgreementsOperations(
7582
self._client, self._config, self._serialize, self._deserialize
7683
)
84+
self.creation_supported = CreationSupportedOperations(
85+
self._client, self._config, self._serialize, self._deserialize
86+
)
7787
self.monitors = MonitorsOperations(self._client, self._config, self._serialize, self._deserialize)
7888
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
7989
self.tag_rules = TagRulesOperations(self._client, self._config, self._serialize, self._deserialize)
8090
self.single_sign_on_configurations = SingleSignOnConfigurationsOperations(
8191
self._client, self._config, self._serialize, self._deserialize
8292
)
93+
self.monitored_subscriptions = MonitoredSubscriptionsOperations(
94+
self._client, self._config, self._serialize, self._deserialize
95+
)
8396

8497
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
8598
"""Runs the network request through the client's chained policies.
@@ -103,15 +116,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
103116
request_copy.url = self._client.format_url(request_copy.url)
104117
return self._client.send_request(request_copy, **kwargs)
105118

106-
def close(self):
107-
# type: () -> None
119+
def close(self) -> None:
108120
self._client.close()
109121

110-
def __enter__(self):
111-
# type: () -> MicrosoftDatadogClient
122+
def __enter__(self) -> "MicrosoftDatadogClient":
112123
self._client.__enter__()
113124
return self
114125

115-
def __exit__(self, *exc_details):
116-
# type: (Any) -> None
126+
def __exit__(self, *exc_details: Any) -> None:
117127
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)