Skip to content

Commit 6843792

Browse files
author
SDKAuto
committed
CodeGen from PR 30578 in Azure/azure-rest-api-specs
Merge 9f730fd52e48c9e604f212e0e69481df27c1fa99 into 63c41aa20e38fe6d2ddd1a367b4fe57e8b601c34
1 parent c065216 commit 6843792

File tree

893 files changed

+9959
-161712
lines changed

Some content is hidden

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

893 files changed

+9959
-161712
lines changed

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

Lines changed: 2 additions & 5 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 Monitor Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
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,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
5959
If you encounter any bugs or have suggestions, please file an issue in the
6060
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6161
section of the project.
62-
63-
64-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-monitor%2FREADME.png)
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "817e7cea0b7e3194868825cbef6d4e62a7895951",
2+
"commit": "9c243d7f39e96402c94facc2ceb591e13a4f62b4",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/monitor/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10-
"readme": "specification/monitor/resource-manager/readme.md"
4+
"typespec_src": "specification/monitor/Microsoft.Monitor.Management",
5+
"@azure-tools/typespec-python": "0.35.1"
116
}

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._monitor_management_client import MonitorManagementClient
10-
__all__ = ['MonitorManagementClient']
9+
from ._client import MonitorManagementClient
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
1113

1214
try:
13-
from ._patch import patch_sdk # type: ignore
14-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1517
except ImportError:
16-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
1720

18-
from ._version import VERSION
21+
__all__ = [
22+
"MonitorManagementClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
1925

20-
__version__ = VERSION
26+
_patch_sdk()
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
12+
13+
from azure.core.pipeline import policies
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
17+
18+
from ._configuration import MonitorManagementClientConfiguration
19+
from ._serialization import Deserializer, Serializer
20+
from .operations import AzureMonitorWorkspacesOperations, Operations, PipelineGroupsOperations
21+
22+
if TYPE_CHECKING:
23+
from azure.core.credentials import TokenCredential
24+
25+
26+
class MonitorManagementClient:
27+
"""Provides operations for working with Azure Monitor.
28+
29+
:ivar operations: Operations operations
30+
:vartype operations: azure.mgmt.monitor.operations.Operations
31+
:ivar azure_monitor_workspaces: AzureMonitorWorkspacesOperations operations
32+
:vartype azure_monitor_workspaces:
33+
azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations
34+
:ivar pipeline_groups: PipelineGroupsOperations operations
35+
:vartype pipeline_groups: azure.mgmt.monitor.operations.PipelineGroupsOperations
36+
:param credential: Credential used to authenticate requests to the service. Required.
37+
:type credential: ~azure.core.credentials.TokenCredential
38+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
39+
:type subscription_id: str
40+
:param base_url: Service host. Default value is "https://management.azure.com".
41+
:type base_url: str
42+
:keyword api_version: The API version to use for this operation. Default value is
43+
"2023-10-01-preview". Note that overriding this default value may result in unsupported
44+
behavior.
45+
:paramtype api_version: str
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
47+
Retry-After header is present.
48+
"""
49+
50+
def __init__(
51+
self,
52+
credential: "TokenCredential",
53+
subscription_id: str,
54+
base_url: str = "https://management.azure.com",
55+
**kwargs: Any
56+
) -> None:
57+
_endpoint = "{endpoint}"
58+
self._config = MonitorManagementClientConfiguration(
59+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
60+
)
61+
_policies = kwargs.pop("policies", None)
62+
if _policies is None:
63+
_policies = [
64+
policies.RequestIdPolicy(**kwargs),
65+
self._config.headers_policy,
66+
self._config.user_agent_policy,
67+
self._config.proxy_policy,
68+
policies.ContentDecodePolicy(**kwargs),
69+
ARMAutoResourceProviderRegistrationPolicy(),
70+
self._config.redirect_policy,
71+
self._config.retry_policy,
72+
self._config.authentication_policy,
73+
self._config.custom_hook_policy,
74+
self._config.logging_policy,
75+
policies.DistributedTracingPolicy(**kwargs),
76+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
77+
self._config.http_logging_policy,
78+
]
79+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
80+
81+
self._serialize = Serializer()
82+
self._deserialize = Deserializer()
83+
self._serialize.client_side_validation = False
84+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
85+
self.azure_monitor_workspaces = AzureMonitorWorkspacesOperations(
86+
self._client, self._config, self._serialize, self._deserialize
87+
)
88+
self.pipeline_groups = PipelineGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
89+
90+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
91+
"""Runs the network request through the client's chained policies.
92+
93+
>>> from azure.core.rest import HttpRequest
94+
>>> request = HttpRequest("GET", "https://www.example.org/")
95+
<HttpRequest [GET], url: 'https://www.example.org/'>
96+
>>> response = client.send_request(request)
97+
<HttpResponse: 200 OK>
98+
99+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
100+
101+
:param request: The network request you want to make. Required.
102+
:type request: ~azure.core.rest.HttpRequest
103+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
104+
:return: The response of your network call. Does not do error handling on your response.
105+
:rtype: ~azure.core.rest.HttpResponse
106+
"""
107+
108+
request_copy = deepcopy(request)
109+
path_format_arguments = {
110+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
111+
}
112+
113+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
114+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
115+
116+
def close(self) -> None:
117+
self._client.close()
118+
119+
def __enter__(self) -> Self:
120+
self._client.__enter__()
121+
return self
122+
123+
def __exit__(self, *exc_details: Any) -> None:
124+
self._client.__exit__(*exc_details)
Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,74 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
7-
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
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.
107
# --------------------------------------------------------------------------
8+
119
from typing import Any, TYPE_CHECKING
1210

13-
from azure.core.configuration import Configuration
1411
from azure.core.pipeline import policies
1512
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1613

1714
from ._version import VERSION
1815

1916
if TYPE_CHECKING:
20-
# pylint: disable=unused-import,ungrouped-imports
2117
from azure.core.credentials import TokenCredential
2218

23-
class MonitorManagementClientConfiguration(Configuration):
19+
20+
class MonitorManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
2421
"""Configuration for MonitorManagementClient.
2522
2623
Note that all parameters used to create this instance are saved as instance
2724
attributes.
2825
29-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
3027
:type credential: ~azure.core.credentials.TokenCredential
31-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3229
:type subscription_id: str
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is
33+
"2023-10-01-preview". Note that overriding this default value may result in unsupported
34+
behavior.
35+
:paramtype api_version: str
3336
"""
3437

3538
def __init__(
3639
self,
3740
credential: "TokenCredential",
3841
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
3943
**kwargs: Any
40-
):
44+
) -> None:
45+
api_version: str = kwargs.pop("api_version", "2023-10-01-preview")
46+
4147
if credential is None:
4248
raise ValueError("Parameter 'credential' must not be None.")
4349
if subscription_id is None:
4450
raise ValueError("Parameter 'subscription_id' must not be None.")
45-
super(MonitorManagementClientConfiguration, self).__init__(**kwargs)
4651

4752
self.credential = credential
4853
self.subscription_id = subscription_id
49-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
50-
kwargs.setdefault('sdk_moniker', 'azure-mgmt-monitor/{}'.format(VERSION))
54+
self.base_url = base_url
55+
self.api_version = api_version
56+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
57+
kwargs.setdefault("sdk_moniker", "mgmt-monitor/{}".format(VERSION))
58+
self.polling_interval = kwargs.get("polling_interval", 30)
5159
self._configure(**kwargs)
5260

53-
def _configure(
54-
self,
55-
**kwargs: Any
56-
):
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')
61+
def _configure(self, **kwargs: Any) -> None:
62+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
63+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
64+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
65+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
66+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
67+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
68+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
69+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
70+
self.authentication_policy = kwargs.get("authentication_policy")
6671
if self.credential and not self.authentication_policy:
67-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
72+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
73+
self.credential, *self.credential_scopes, **kwargs
74+
)

0 commit comments

Comments
 (0)