Skip to content

Commit f704c74

Browse files
author
SDKAuto
committed
CodeGen from PR 17265 in Azure/azure-rest-api-specs
Merge 72f2a41a7db67f660dec9578a26ec222f8de945b into 8830149
1 parent fd5f23c commit f704c74

File tree

58 files changed

+7215
-6523
lines changed

Some content is hidden

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

58 files changed

+7215
-6523
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.7.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/[email protected].2"
4+
"@autorest/python@5.12.0",
5+
"@autorest/[email protected].3"
66
],
7-
"commit": "1c520d5661b24e584bade4e4fe4993a39a43affd",
7+
"commit": "f42ec09f94fa07ab1c5d896859bef1cbe1b69607",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/operationalinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/[email protected].2 --version=3.4.5",
9+
"autorest_command": "autorest specification/operationalinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/[email protected].3 --version=3.7.2",
1010
"readme": "specification/operationalinsights/resource-manager/readme.md"
1111
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['LogAnalyticsManagementClient']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
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()

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

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

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -35,16 +33,15 @@ class LogAnalyticsManagementClientConfiguration(Configuration):
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
40+
super(LogAnalyticsManagementClientConfiguration, self).__init__(**kwargs)
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(LogAnalyticsManagementClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
@@ -67,4 +64,4 @@ def _configure(
6764
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6865
self.authentication_policy = kwargs.get('authentication_policy')
6966
if self.credential and not self.authentication_policy:
70-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

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

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

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

16+
from . import models
17+
from ._configuration import LogAnalyticsManagementClientConfiguration
18+
from .operations import AvailableServiceTiersOperations, ClustersOperations, DataExportsOperations, DataSourcesOperations, DeletedWorkspacesOperations, GatewaysOperations, IntelligencePacksOperations, LinkedServicesOperations, LinkedStorageAccountsOperations, ManagementGroupsOperations, OperationStatusesOperations, Operations, SavedSearchesOperations, SchemaOperations, SharedKeysOperations, StorageInsightConfigsOperations, TablesOperations, UsagesOperations, WorkspacePurgeOperations, WorkspacesOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import LogAnalyticsManagementClientConfiguration
22-
from .operations import DataExportsOperations
23-
from .operations import DataSourcesOperations
24-
from .operations import IntelligencePacksOperations
25-
from .operations import LinkedServicesOperations
26-
from .operations import LinkedStorageAccountsOperations
27-
from .operations import ManagementGroupsOperations
28-
from .operations import OperationStatusesOperations
29-
from .operations import SharedKeysOperations
30-
from .operations import UsagesOperations
31-
from .operations import StorageInsightConfigsOperations
32-
from .operations import SavedSearchesOperations
33-
from .operations import AvailableServiceTiersOperations
34-
from .operations import GatewaysOperations
35-
from .operations import SchemaOperations
36-
from .operations import WorkspacePurgeOperations
37-
from .operations import Operations
38-
from .operations import TablesOperations
39-
from .operations import ClustersOperations
40-
from .operations import WorkspacesOperations
41-
from .operations import DeletedWorkspacesOperations
42-
from . import models
43-
4423

45-
class LogAnalyticsManagementClient(object):
24+
class LogAnalyticsManagementClient:
4625
"""Operational Insights Client.
4726
27+
:ivar operations: Operations operations
28+
:vartype operations: azure.mgmt.loganalytics.operations.Operations
29+
:ivar workspaces: WorkspacesOperations operations
30+
:vartype workspaces: azure.mgmt.loganalytics.operations.WorkspacesOperations
31+
:ivar deleted_workspaces: DeletedWorkspacesOperations operations
32+
:vartype deleted_workspaces: azure.mgmt.loganalytics.operations.DeletedWorkspacesOperations
33+
:ivar tables: TablesOperations operations
34+
:vartype tables: azure.mgmt.loganalytics.operations.TablesOperations
4835
:ivar data_exports: DataExportsOperations operations
4936
:vartype data_exports: azure.mgmt.loganalytics.operations.DataExportsOperations
5037
:ivar data_sources: DataSourcesOperations operations
@@ -54,7 +41,8 @@ class LogAnalyticsManagementClient(object):
5441
:ivar linked_services: LinkedServicesOperations operations
5542
:vartype linked_services: azure.mgmt.loganalytics.operations.LinkedServicesOperations
5643
:ivar linked_storage_accounts: LinkedStorageAccountsOperations operations
57-
:vartype linked_storage_accounts: azure.mgmt.loganalytics.operations.LinkedStorageAccountsOperations
44+
:vartype linked_storage_accounts:
45+
azure.mgmt.loganalytics.operations.LinkedStorageAccountsOperations
5846
:ivar management_groups: ManagementGroupsOperations operations
5947
:vartype management_groups: azure.mgmt.loganalytics.operations.ManagementGroupsOperations
6048
:ivar operation_statuses: OperationStatusesOperations operations
@@ -64,111 +52,92 @@ class LogAnalyticsManagementClient(object):
6452
:ivar usages: UsagesOperations operations
6553
:vartype usages: azure.mgmt.loganalytics.operations.UsagesOperations
6654
:ivar storage_insight_configs: StorageInsightConfigsOperations operations
67-
:vartype storage_insight_configs: azure.mgmt.loganalytics.operations.StorageInsightConfigsOperations
55+
:vartype storage_insight_configs:
56+
azure.mgmt.loganalytics.operations.StorageInsightConfigsOperations
6857
:ivar saved_searches: SavedSearchesOperations operations
6958
:vartype saved_searches: azure.mgmt.loganalytics.operations.SavedSearchesOperations
7059
:ivar available_service_tiers: AvailableServiceTiersOperations operations
71-
:vartype available_service_tiers: azure.mgmt.loganalytics.operations.AvailableServiceTiersOperations
60+
:vartype available_service_tiers:
61+
azure.mgmt.loganalytics.operations.AvailableServiceTiersOperations
7262
:ivar gateways: GatewaysOperations operations
7363
:vartype gateways: azure.mgmt.loganalytics.operations.GatewaysOperations
7464
:ivar schema: SchemaOperations operations
7565
:vartype schema: azure.mgmt.loganalytics.operations.SchemaOperations
7666
:ivar workspace_purge: WorkspacePurgeOperations operations
7767
:vartype workspace_purge: azure.mgmt.loganalytics.operations.WorkspacePurgeOperations
78-
:ivar operations: Operations operations
79-
:vartype operations: azure.mgmt.loganalytics.operations.Operations
80-
:ivar tables: TablesOperations operations
81-
:vartype tables: azure.mgmt.loganalytics.operations.TablesOperations
8268
:ivar clusters: ClustersOperations operations
8369
:vartype clusters: azure.mgmt.loganalytics.operations.ClustersOperations
84-
:ivar workspaces: WorkspacesOperations operations
85-
:vartype workspaces: azure.mgmt.loganalytics.operations.WorkspacesOperations
86-
:ivar deleted_workspaces: DeletedWorkspacesOperations operations
87-
:vartype deleted_workspaces: azure.mgmt.loganalytics.operations.DeletedWorkspacesOperations
8870
:param credential: Credential needed for the client to connect to Azure.
8971
:type credential: ~azure.core.credentials.TokenCredential
9072
:param subscription_id: The ID of the target subscription.
9173
:type subscription_id: str
92-
:param str base_url: Service URL
93-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
74+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
75+
:type base_url: str
76+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
77+
Retry-After header is present.
9478
"""
9579

9680
def __init__(
9781
self,
98-
credential, # type: "TokenCredential"
99-
subscription_id, # type: str
100-
base_url=None, # type: Optional[str]
101-
**kwargs # type: Any
102-
):
103-
# type: (...) -> None
104-
if not base_url:
105-
base_url = 'https://management.azure.com'
106-
self._config = LogAnalyticsManagementClientConfiguration(credential, subscription_id, **kwargs)
82+
credential: "TokenCredential",
83+
subscription_id: str,
84+
base_url: str = "https://management.azure.com",
85+
**kwargs: Any
86+
) -> None:
87+
self._config = LogAnalyticsManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
10788
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
10889

10990
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
11091
self._serialize = Serializer(client_models)
111-
self._serialize.client_side_validation = False
11292
self._deserialize = Deserializer(client_models)
113-
114-
self.data_exports = DataExportsOperations(
115-
self._client, self._config, self._serialize, self._deserialize)
116-
self.data_sources = DataSourcesOperations(
117-
self._client, self._config, self._serialize, self._deserialize)
118-
self.intelligence_packs = IntelligencePacksOperations(
119-
self._client, self._config, self._serialize, self._deserialize)
120-
self.linked_services = LinkedServicesOperations(
121-
self._client, self._config, self._serialize, self._deserialize)
122-
self.linked_storage_accounts = LinkedStorageAccountsOperations(
123-
self._client, self._config, self._serialize, self._deserialize)
124-
self.management_groups = ManagementGroupsOperations(
125-
self._client, self._config, self._serialize, self._deserialize)
126-
self.operation_statuses = OperationStatusesOperations(
127-
self._client, self._config, self._serialize, self._deserialize)
128-
self.shared_keys = SharedKeysOperations(
129-
self._client, self._config, self._serialize, self._deserialize)
130-
self.usages = UsagesOperations(
131-
self._client, self._config, self._serialize, self._deserialize)
132-
self.storage_insight_configs = StorageInsightConfigsOperations(
133-
self._client, self._config, self._serialize, self._deserialize)
134-
self.saved_searches = SavedSearchesOperations(
135-
self._client, self._config, self._serialize, self._deserialize)
136-
self.available_service_tiers = AvailableServiceTiersOperations(
137-
self._client, self._config, self._serialize, self._deserialize)
138-
self.gateways = GatewaysOperations(
139-
self._client, self._config, self._serialize, self._deserialize)
140-
self.schema = SchemaOperations(
141-
self._client, self._config, self._serialize, self._deserialize)
142-
self.workspace_purge = WorkspacePurgeOperations(
143-
self._client, self._config, self._serialize, self._deserialize)
144-
self.operations = Operations(
145-
self._client, self._config, self._serialize, self._deserialize)
146-
self.tables = TablesOperations(
147-
self._client, self._config, self._serialize, self._deserialize)
148-
self.clusters = ClustersOperations(
149-
self._client, self._config, self._serialize, self._deserialize)
150-
self.workspaces = WorkspacesOperations(
151-
self._client, self._config, self._serialize, self._deserialize)
152-
self.deleted_workspaces = DeletedWorkspacesOperations(
153-
self._client, self._config, self._serialize, self._deserialize)
154-
155-
def _send_request(self, http_request, **kwargs):
156-
# type: (HttpRequest, Any) -> HttpResponse
93+
self._serialize.client_side_validation = False
94+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
95+
self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.deleted_workspaces = DeletedWorkspacesOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.tables = TablesOperations(self._client, self._config, self._serialize, self._deserialize)
98+
self.data_exports = DataExportsOperations(self._client, self._config, self._serialize, self._deserialize)
99+
self.data_sources = DataSourcesOperations(self._client, self._config, self._serialize, self._deserialize)
100+
self.intelligence_packs = IntelligencePacksOperations(self._client, self._config, self._serialize, self._deserialize)
101+
self.linked_services = LinkedServicesOperations(self._client, self._config, self._serialize, self._deserialize)
102+
self.linked_storage_accounts = LinkedStorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize)
103+
self.management_groups = ManagementGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
104+
self.operation_statuses = OperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize)
105+
self.shared_keys = SharedKeysOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
107+
self.storage_insight_configs = StorageInsightConfigsOperations(self._client, self._config, self._serialize, self._deserialize)
108+
self.saved_searches = SavedSearchesOperations(self._client, self._config, self._serialize, self._deserialize)
109+
self.available_service_tiers = AvailableServiceTiersOperations(self._client, self._config, self._serialize, self._deserialize)
110+
self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize)
111+
self.schema = SchemaOperations(self._client, self._config, self._serialize, self._deserialize)
112+
self.workspace_purge = WorkspacePurgeOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
114+
115+
116+
def _send_request(
117+
self,
118+
request, # type: HttpRequest
119+
**kwargs: Any
120+
) -> HttpResponse:
157121
"""Runs the network request through the client's chained policies.
158122
159-
:param http_request: The network request you want to make. Required.
160-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
161-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
123+
>>> from azure.core.rest import HttpRequest
124+
>>> request = HttpRequest("GET", "https://www.example.org/")
125+
<HttpRequest [GET], url: 'https://www.example.org/'>
126+
>>> response = client._send_request(request)
127+
<HttpResponse: 200 OK>
128+
129+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
130+
131+
:param request: The network request you want to make. Required.
132+
:type request: ~azure.core.rest.HttpRequest
133+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
162134
:return: The response of your network call. Does not do error handling on your response.
163-
:rtype: ~azure.core.pipeline.transport.HttpResponse
135+
:rtype: ~azure.core.rest.HttpResponse
164136
"""
165-
path_format_arguments = {
166-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
167-
}
168-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
169-
stream = kwargs.pop("stream", True)
170-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
171-
return pipeline_response.http_response
137+
138+
request_copy = deepcopy(request)
139+
request_copy.url = self._client.format_url(request_copy.url)
140+
return self._client.send_request(request_copy, **kwargs)
172141

173142
def close(self):
174143
# type: () -> None

0 commit comments

Comments
 (0)