Skip to content

Commit

Permalink
[AutoRelease] t2-datadog-2023-10-06-51944(can only be merged by SDK o…
Browse files Browse the repository at this point in the history
…wner) (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>
  • Loading branch information
azure-sdk and ChenxiJiang333 authored Oct 23, 2023
1 parent 64627c3 commit 525b684
Show file tree
Hide file tree
Showing 62 changed files with 3,962 additions and 948 deletions.
10 changes: 10 additions & 0 deletions sdk/datadog/azure-mgmt-datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release History

## 2.1.0 (2023-10-23)

### Features Added

- Added operation group CreationSupportedOperations
- Added operation group MonitoredSubscriptionsOperations
- Model DatadogOrganizationProperties has a new parameter cspm
- Model MonitorUpdateProperties has a new parameter cspm
- Model MonitoringTagRulesProperties has a new parameter automuting

## 2.1.0b1 (2022-11-02)

### Other Changes
Expand Down
53 changes: 43 additions & 10 deletions sdk/datadog/azure-mgmt-datadog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,54 @@ For a more complete view of Azure libraries, see the [azure sdk python release](

_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
## Getting started

### Prerequisites

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 [Datadog 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)
- Python 3.7+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

# Provide Feedback
```bash
pip install azure-mgmt-datadog
pip install azure-identity
```

### Authentication

By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` for Azure client secret.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.

With above configuration, client can be authenticated by following code:

```python
from azure.identity import DefaultAzureCredential
from azure.mgmt.datadog import MicrosoftDatadogClient
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = MicrosoftDatadogClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Examples

Code samples for this package can be found at:
- [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
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


## Troubleshooting

## Next steps

## 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-datadog%2FREADME.png)
10 changes: 5 additions & 5 deletions sdk/datadog/azure-mgmt-datadog/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "0c21115ccacbbad11c4aa13a711e4990ebf07752",
"commit": "75fe114f1abd9d9269591123eb96ac4660e7a095",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.2.1",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"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",
"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",
"readme": "specification/datadog/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -35,14 +29,14 @@ class MicrosoftDatadogClientConfiguration(Configuration): # pylint: disable=too
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-01-01". 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(MicrosoftDatadogClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"]
api_version: str = kwargs.pop("api_version", "2023-01-01")

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

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from . import models
from . import models as _models
from ._configuration import MicrosoftDatadogClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
CreationSupportedOperations,
MarketplaceAgreementsOperations,
MonitoredSubscriptionsOperations,
MonitorsOperations,
Operations,
SingleSignOnConfigurationsOperations,
Expand All @@ -28,11 +30,13 @@
from azure.core.credentials import TokenCredential


class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword
class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""MicrosoftDatadogClient.
:ivar marketplace_agreements: MarketplaceAgreementsOperations operations
:vartype marketplace_agreements: azure.mgmt.datadog.operations.MarketplaceAgreementsOperations
:ivar creation_supported: CreationSupportedOperations operations
:vartype creation_supported: azure.mgmt.datadog.operations.CreationSupportedOperations
:ivar monitors: MonitorsOperations operations
:vartype monitors: azure.mgmt.datadog.operations.MonitorsOperations
:ivar operations: Operations operations
Expand All @@ -42,13 +46,16 @@ class MicrosoftDatadogClient: # pylint: disable=client-accepts-api-version-keyw
:ivar single_sign_on_configurations: SingleSignOnConfigurationsOperations operations
:vartype single_sign_on_configurations:
azure.mgmt.datadog.operations.SingleSignOnConfigurationsOperations
:ivar monitored_subscriptions: MonitoredSubscriptionsOperations operations
:vartype monitored_subscriptions:
azure.mgmt.datadog.operations.MonitoredSubscriptionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
: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 "2022-06-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2023-01-01". 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
Expand All @@ -65,21 +72,27 @@ def __init__(
self._config = MicrosoftDatadogClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
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.marketplace_agreements = MarketplaceAgreementsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.creation_supported = CreationSupportedOperations(
self._client, self._config, self._serialize, self._deserialize
)
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_configurations = SingleSignOnConfigurationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.monitored_subscriptions = MonitoredSubscriptionsOperations(
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.
Expand All @@ -103,15 +116,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> MicrosoftDatadogClient
def __enter__(self) -> "MicrosoftDatadogClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Loading

0 comments on commit 525b684

Please sign in to comment.