Skip to content

Commit cc9d075

Browse files
author
SDKAuto
committed
CodeGen from PR 30394 in Azure/azure-rest-api-specs
Merge 5f9d1601f4690139317fc5ed671764810213513e into eea7584434f9225cad0327d83d5c6d84257a4d7d
1 parent b33b649 commit cc9d075

File tree

170 files changed

+6974
-4408
lines changed

Some content is hidden

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

170 files changed

+6974
-4408
lines changed

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

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Log Analytics Management 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_
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 [Log Analytics 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://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/loganalytics)
15+
- Python 3.8+ 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-loganalytics
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.loganalytics import LogAnalyticsManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = LogAnalyticsManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Log Analytics 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-loganalytics%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "23b62d4e4dab07dccda851cfe50f6c6afb705a3b",
2+
"commit": "bbb5623a4fa1cbb51138a78a52b573066f26c7fe",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.19.0",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/operationalinsights/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.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/operationalinsights/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/operationalinsights/resource-manager/readme.md"
1111
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

@@ -19,7 +18,7 @@
1918
from azure.core.credentials import TokenCredential
2019

2120

22-
class LogAnalyticsManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class LogAnalyticsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2322
"""Configuration for LogAnalyticsManagementClient.
2423
2524
Note that all parameters used to create this instance are saved as instance
@@ -32,7 +31,6 @@ class LogAnalyticsManagementClientConfiguration(Configuration): # pylint: disab
3231
"""
3332

3433
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
35-
super(LogAnalyticsManagementClientConfiguration, self).__init__(**kwargs)
3634
if credential is None:
3735
raise ValueError("Parameter 'credential' must not be None.")
3836
if subscription_id is None:
@@ -42,6 +40,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4240
self.subscription_id = subscription_id
4341
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4442
kwargs.setdefault("sdk_moniker", "mgmt-loganalytics/{}".format(VERSION))
43+
self.polling_interval = kwargs.get("polling_interval", 30)
4544
self._configure(**kwargs)
4645

4746
def _configure(self, **kwargs: Any) -> None:
@@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None:
5049
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5150
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5251
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
53-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5452
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5553
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
54+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5655
self.authentication_policy = kwargs.get("authentication_policy")
5756
if self.credential and not self.authentication_policy:
5857
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/_log_analytics_management_client.py

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

1518
from . import models as _models
1619
from ._configuration import LogAnalyticsManagementClientConfiguration
@@ -48,14 +51,17 @@
4851
class LogAnalyticsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
4952
"""Operational Insights Client.
5053
51-
:ivar query_packs: QueryPacksOperations operations
52-
:vartype query_packs: azure.mgmt.loganalytics.operations.QueryPacksOperations
53-
:ivar queries: QueriesOperations operations
54-
:vartype queries: azure.mgmt.loganalytics.operations.QueriesOperations
54+
:ivar available_service_tiers: AvailableServiceTiersOperations operations
55+
:vartype available_service_tiers:
56+
azure.mgmt.loganalytics.operations.AvailableServiceTiersOperations
57+
:ivar clusters: ClustersOperations operations
58+
:vartype clusters: azure.mgmt.loganalytics.operations.ClustersOperations
5559
:ivar data_exports: DataExportsOperations operations
5660
:vartype data_exports: azure.mgmt.loganalytics.operations.DataExportsOperations
5761
:ivar data_sources: DataSourcesOperations operations
5862
:vartype data_sources: azure.mgmt.loganalytics.operations.DataSourcesOperations
63+
:ivar gateways: GatewaysOperations operations
64+
:vartype gateways: azure.mgmt.loganalytics.operations.GatewaysOperations
5965
:ivar intelligence_packs: IntelligencePacksOperations operations
6066
:vartype intelligence_packs: azure.mgmt.loganalytics.operations.IntelligencePacksOperations
6167
:ivar linked_services: LinkedServicesOperations operations
@@ -65,36 +71,33 @@ class LogAnalyticsManagementClient: # pylint: disable=client-accepts-api-versio
6571
azure.mgmt.loganalytics.operations.LinkedStorageAccountsOperations
6672
:ivar management_groups: ManagementGroupsOperations operations
6773
:vartype management_groups: azure.mgmt.loganalytics.operations.ManagementGroupsOperations
74+
:ivar operations: Operations operations
75+
:vartype operations: azure.mgmt.loganalytics.operations.Operations
6876
:ivar operation_statuses: OperationStatusesOperations operations
6977
:vartype operation_statuses: azure.mgmt.loganalytics.operations.OperationStatusesOperations
78+
:ivar saved_searches: SavedSearchesOperations operations
79+
:vartype saved_searches: azure.mgmt.loganalytics.operations.SavedSearchesOperations
80+
:ivar schema: SchemaOperations operations
81+
:vartype schema: azure.mgmt.loganalytics.operations.SchemaOperations
7082
:ivar shared_keys: SharedKeysOperations operations
7183
:vartype shared_keys: azure.mgmt.loganalytics.operations.SharedKeysOperations
72-
:ivar usages: UsagesOperations operations
73-
:vartype usages: azure.mgmt.loganalytics.operations.UsagesOperations
7484
:ivar storage_insight_configs: StorageInsightConfigsOperations operations
7585
:vartype storage_insight_configs:
7686
azure.mgmt.loganalytics.operations.StorageInsightConfigsOperations
77-
:ivar saved_searches: SavedSearchesOperations operations
78-
:vartype saved_searches: azure.mgmt.loganalytics.operations.SavedSearchesOperations
79-
:ivar available_service_tiers: AvailableServiceTiersOperations operations
80-
:vartype available_service_tiers:
81-
azure.mgmt.loganalytics.operations.AvailableServiceTiersOperations
82-
:ivar gateways: GatewaysOperations operations
83-
:vartype gateways: azure.mgmt.loganalytics.operations.GatewaysOperations
84-
:ivar schema: SchemaOperations operations
85-
:vartype schema: azure.mgmt.loganalytics.operations.SchemaOperations
87+
:ivar tables: TablesOperations operations
88+
:vartype tables: azure.mgmt.loganalytics.operations.TablesOperations
89+
:ivar usages: UsagesOperations operations
90+
:vartype usages: azure.mgmt.loganalytics.operations.UsagesOperations
8691
:ivar workspace_purge: WorkspacePurgeOperations operations
8792
:vartype workspace_purge: azure.mgmt.loganalytics.operations.WorkspacePurgeOperations
88-
:ivar clusters: ClustersOperations operations
89-
:vartype clusters: azure.mgmt.loganalytics.operations.ClustersOperations
90-
:ivar operations: Operations operations
91-
:vartype operations: azure.mgmt.loganalytics.operations.Operations
9293
:ivar workspaces: WorkspacesOperations operations
9394
:vartype workspaces: azure.mgmt.loganalytics.operations.WorkspacesOperations
9495
:ivar deleted_workspaces: DeletedWorkspacesOperations operations
9596
:vartype deleted_workspaces: azure.mgmt.loganalytics.operations.DeletedWorkspacesOperations
96-
:ivar tables: TablesOperations operations
97-
:vartype tables: azure.mgmt.loganalytics.operations.TablesOperations
97+
:ivar queries: QueriesOperations operations
98+
:vartype queries: azure.mgmt.loganalytics.operations.QueriesOperations
99+
:ivar query_packs: QueryPacksOperations operations
100+
:vartype query_packs: azure.mgmt.loganalytics.operations.QueryPacksOperations
98101
:param credential: Credential needed for the client to connect to Azure. Required.
99102
:type credential: ~azure.core.credentials.TokenCredential
100103
:param subscription_id: The ID of the target subscription. Required.
@@ -115,16 +118,37 @@ def __init__(
115118
self._config = LogAnalyticsManagementClientConfiguration(
116119
credential=credential, subscription_id=subscription_id, **kwargs
117120
)
118-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
121+
_policies = kwargs.pop("policies", None)
122+
if _policies is None:
123+
_policies = [
124+
policies.RequestIdPolicy(**kwargs),
125+
self._config.headers_policy,
126+
self._config.user_agent_policy,
127+
self._config.proxy_policy,
128+
policies.ContentDecodePolicy(**kwargs),
129+
ARMAutoResourceProviderRegistrationPolicy(),
130+
self._config.redirect_policy,
131+
self._config.retry_policy,
132+
self._config.authentication_policy,
133+
self._config.custom_hook_policy,
134+
self._config.logging_policy,
135+
policies.DistributedTracingPolicy(**kwargs),
136+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
137+
self._config.http_logging_policy,
138+
]
139+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
119140

120141
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
121142
self._serialize = Serializer(client_models)
122143
self._deserialize = Deserializer(client_models)
123144
self._serialize.client_side_validation = False
124-
self.query_packs = QueryPacksOperations(self._client, self._config, self._serialize, self._deserialize)
125-
self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize)
145+
self.available_service_tiers = AvailableServiceTiersOperations(
146+
self._client, self._config, self._serialize, self._deserialize
147+
)
148+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
126149
self.data_exports = DataExportsOperations(self._client, self._config, self._serialize, self._deserialize)
127150
self.data_sources = DataSourcesOperations(self._client, self._config, self._serialize, self._deserialize)
151+
self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize)
128152
self.intelligence_packs = IntelligencePacksOperations(
129153
self._client, self._config, self._serialize, self._deserialize
130154
)
@@ -135,30 +159,27 @@ def __init__(
135159
self.management_groups = ManagementGroupsOperations(
136160
self._client, self._config, self._serialize, self._deserialize
137161
)
162+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
138163
self.operation_statuses = OperationStatusesOperations(
139164
self._client, self._config, self._serialize, self._deserialize
140165
)
166+
self.saved_searches = SavedSearchesOperations(self._client, self._config, self._serialize, self._deserialize)
167+
self.schema = SchemaOperations(self._client, self._config, self._serialize, self._deserialize)
141168
self.shared_keys = SharedKeysOperations(self._client, self._config, self._serialize, self._deserialize)
142-
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
143169
self.storage_insight_configs = StorageInsightConfigsOperations(
144170
self._client, self._config, self._serialize, self._deserialize
145171
)
146-
self.saved_searches = SavedSearchesOperations(self._client, self._config, self._serialize, self._deserialize)
147-
self.available_service_tiers = AvailableServiceTiersOperations(
148-
self._client, self._config, self._serialize, self._deserialize
149-
)
150-
self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize)
151-
self.schema = SchemaOperations(self._client, self._config, self._serialize, self._deserialize)
172+
self.tables = TablesOperations(self._client, self._config, self._serialize, self._deserialize)
173+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
152174
self.workspace_purge = WorkspacePurgeOperations(self._client, self._config, self._serialize, self._deserialize)
153-
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
154-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
155175
self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize)
156176
self.deleted_workspaces = DeletedWorkspacesOperations(
157177
self._client, self._config, self._serialize, self._deserialize
158178
)
159-
self.tables = TablesOperations(self._client, self._config, self._serialize, self._deserialize)
179+
self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize)
180+
self.query_packs = QueryPacksOperations(self._client, self._config, self._serialize, self._deserialize)
160181

161-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
182+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
162183
"""Runs the network request through the client's chained policies.
163184
164185
>>> from azure.core.rest import HttpRequest
@@ -178,14 +199,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
178199

179200
request_copy = deepcopy(request)
180201
request_copy.url = self._client.format_url(request_copy.url)
181-
return self._client.send_request(request_copy, **kwargs)
202+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
182203

183204
def close(self) -> None:
184205
self._client.close()
185206

186-
def __enter__(self) -> "LogAnalyticsManagementClient":
207+
def __enter__(self) -> Self:
187208
self._client.__enter__()
188209
return self
189210

190-
def __exit__(self, *exc_details) -> None:
211+
def __exit__(self, *exc_details: Any) -> None:
191212
self._client.__exit__(*exc_details)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#
2626
# --------------------------------------------------------------------------
2727

28+
2829
# This file is used for handwritten extensions to the generated code. Example:
2930
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3031
def patch_sdk():

0 commit comments

Comments
 (0)