Skip to content

Commit 538defa

Browse files
authored
code and test (Azure#23164)
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
1 parent 00d2505 commit 538defa

Some content is hidden

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

47 files changed

+8668
-8829
lines changed

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

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

3+
## 2.2.0 (2022-02-22)
4+
5+
**Features**
6+
7+
- Added operation group OperationsResultsLocationOperations
8+
- Model Cluster has a new parameter private_endpoint_connections
9+
- Model Cluster has a new parameter public_ip_type
10+
- Model Cluster has a new parameter virtual_cluster_graduation_properties
11+
- Model ClusterPrincipalAssignment has a new parameter aad_object_id
12+
- Model ClusterUpdate has a new parameter private_endpoint_connections
13+
- Model ClusterUpdate has a new parameter public_ip_type
14+
- Model ClusterUpdate has a new parameter virtual_cluster_graduation_properties
15+
- Model DatabasePrincipalAssignment has a new parameter aad_object_id
16+
- Model EventGridDataConnection has a new parameter database_routing
17+
- Model EventGridDataConnection has a new parameter event_grid_resource_id
18+
- Model EventGridDataConnection has a new parameter managed_identity_object_id
19+
- Model EventGridDataConnection has a new parameter managed_identity_resource_id
20+
- Model EventHubDataConnection has a new parameter database_routing
21+
- Model EventHubDataConnection has a new parameter managed_identity_object_id
22+
- Model IotHubDataConnection has a new parameter database_routing
23+
- Model OperationResult has a new parameter provisioning_state
24+
- Model Script has a new parameter script_content
25+
326
## 2.1.0 (2021-09-22)
427

528
**Features**
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": "2ecc4a457776feff5cf647d28c045ea9acffadb3",
7+
"commit": "efd3d669a86d2e123f57ac3a43e5af4bb9e3a29f",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/azure-kusto/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/azure-kusto/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/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/azure-kusto/resource-manager/readme.md"
1111
}

sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/__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__ = ['KustoManagementClient']
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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py

Lines changed: 9 additions & 12 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,20 +33,19 @@ class KustoManagementClientConfiguration(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(KustoManagementClientConfiguration, 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(KustoManagementClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2021-08-27"
48+
self.api_version = "2022-02-01"
5249
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5350
kwargs.setdefault('sdk_moniker', 'mgmt-kusto/{}'.format(VERSION))
5451
self._configure(**kwargs)
@@ -68,4 +65,4 @@ def _configure(
6865
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6966
self.authentication_policy = kwargs.get('authentication_policy')
7067
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py

Lines changed: 72 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,129 +6,122 @@
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 KustoManagementClientConfiguration
18+
from .operations import AttachedDatabaseConfigurationsOperations, ClusterPrincipalAssignmentsOperations, ClustersOperations, DataConnectionsOperations, DatabasePrincipalAssignmentsOperations, DatabasesOperations, ManagedPrivateEndpointsOperations, Operations, OperationsResultsLocationOperations, OperationsResultsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScriptsOperations
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 KustoManagementClientConfiguration
22-
from .operations import ClustersOperations
23-
from .operations import ClusterPrincipalAssignmentsOperations
24-
from .operations import DatabasesOperations
25-
from .operations import AttachedDatabaseConfigurationsOperations
26-
from .operations import ManagedPrivateEndpointsOperations
27-
from .operations import DatabasePrincipalAssignmentsOperations
28-
from .operations import ScriptsOperations
29-
from .operations import PrivateEndpointConnectionsOperations
30-
from .operations import PrivateLinkResourcesOperations
31-
from .operations import DataConnectionsOperations
32-
from .operations import Operations
33-
from .operations import OperationsResultsOperations
34-
from . import models
35-
3623

37-
class KustoManagementClient(object):
24+
class KustoManagementClient:
3825
"""The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases.
3926
4027
:ivar clusters: ClustersOperations operations
4128
:vartype clusters: kusto_management_client.operations.ClustersOperations
4229
:ivar cluster_principal_assignments: ClusterPrincipalAssignmentsOperations operations
43-
:vartype cluster_principal_assignments: kusto_management_client.operations.ClusterPrincipalAssignmentsOperations
30+
:vartype cluster_principal_assignments:
31+
kusto_management_client.operations.ClusterPrincipalAssignmentsOperations
4432
:ivar databases: DatabasesOperations operations
4533
:vartype databases: kusto_management_client.operations.DatabasesOperations
4634
:ivar attached_database_configurations: AttachedDatabaseConfigurationsOperations operations
47-
:vartype attached_database_configurations: kusto_management_client.operations.AttachedDatabaseConfigurationsOperations
35+
:vartype attached_database_configurations:
36+
kusto_management_client.operations.AttachedDatabaseConfigurationsOperations
4837
:ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations
49-
:vartype managed_private_endpoints: kusto_management_client.operations.ManagedPrivateEndpointsOperations
38+
:vartype managed_private_endpoints:
39+
kusto_management_client.operations.ManagedPrivateEndpointsOperations
5040
:ivar database_principal_assignments: DatabasePrincipalAssignmentsOperations operations
51-
:vartype database_principal_assignments: kusto_management_client.operations.DatabasePrincipalAssignmentsOperations
41+
:vartype database_principal_assignments:
42+
kusto_management_client.operations.DatabasePrincipalAssignmentsOperations
5243
:ivar scripts: ScriptsOperations operations
5344
:vartype scripts: kusto_management_client.operations.ScriptsOperations
5445
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
55-
:vartype private_endpoint_connections: kusto_management_client.operations.PrivateEndpointConnectionsOperations
46+
:vartype private_endpoint_connections:
47+
kusto_management_client.operations.PrivateEndpointConnectionsOperations
5648
:ivar private_link_resources: PrivateLinkResourcesOperations operations
57-
:vartype private_link_resources: kusto_management_client.operations.PrivateLinkResourcesOperations
49+
:vartype private_link_resources:
50+
kusto_management_client.operations.PrivateLinkResourcesOperations
5851
:ivar data_connections: DataConnectionsOperations operations
5952
:vartype data_connections: kusto_management_client.operations.DataConnectionsOperations
6053
:ivar operations: Operations operations
6154
:vartype operations: kusto_management_client.operations.Operations
6255
:ivar operations_results: OperationsResultsOperations operations
6356
:vartype operations_results: kusto_management_client.operations.OperationsResultsOperations
57+
:ivar operations_results_location: OperationsResultsLocationOperations operations
58+
:vartype operations_results_location:
59+
kusto_management_client.operations.OperationsResultsLocationOperations
6460
:param credential: Credential needed for the client to connect to Azure.
6561
:type credential: ~azure.core.credentials.TokenCredential
66-
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
62+
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
63+
subscription. The subscription ID forms part of the URI for every service call.
6764
:type subscription_id: str
68-
:param str base_url: Service URL
69-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
65+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
66+
:type base_url: str
67+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
68+
Retry-After header is present.
7069
"""
7170

7271
def __init__(
7372
self,
74-
credential, # type: "TokenCredential"
75-
subscription_id, # type: str
76-
base_url=None, # type: Optional[str]
77-
**kwargs # type: Any
78-
):
79-
# type: (...) -> None
80-
if not base_url:
81-
base_url = 'https://management.azure.com'
82-
self._config = KustoManagementClientConfiguration(credential, subscription_id, **kwargs)
73+
credential: "TokenCredential",
74+
subscription_id: str,
75+
base_url: str = "https://management.azure.com",
76+
**kwargs: Any
77+
) -> None:
78+
self._config = KustoManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
8379
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
8480

8581
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
8682
self._serialize = Serializer(client_models)
87-
self._serialize.client_side_validation = False
8883
self._deserialize = Deserializer(client_models)
89-
90-
self.clusters = ClustersOperations(
91-
self._client, self._config, self._serialize, self._deserialize)
92-
self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations(
93-
self._client, self._config, self._serialize, self._deserialize)
94-
self.databases = DatabasesOperations(
95-
self._client, self._config, self._serialize, self._deserialize)
96-
self.attached_database_configurations = AttachedDatabaseConfigurationsOperations(
97-
self._client, self._config, self._serialize, self._deserialize)
98-
self.managed_private_endpoints = ManagedPrivateEndpointsOperations(
99-
self._client, self._config, self._serialize, self._deserialize)
100-
self.database_principal_assignments = DatabasePrincipalAssignmentsOperations(
101-
self._client, self._config, self._serialize, self._deserialize)
102-
self.scripts = ScriptsOperations(
103-
self._client, self._config, self._serialize, self._deserialize)
104-
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
105-
self._client, self._config, self._serialize, self._deserialize)
106-
self.private_link_resources = PrivateLinkResourcesOperations(
107-
self._client, self._config, self._serialize, self._deserialize)
108-
self.data_connections = DataConnectionsOperations(
109-
self._client, self._config, self._serialize, self._deserialize)
110-
self.operations = Operations(
111-
self._client, self._config, self._serialize, self._deserialize)
112-
self.operations_results = OperationsResultsOperations(
113-
self._client, self._config, self._serialize, self._deserialize)
114-
115-
def _send_request(self, http_request, **kwargs):
116-
# type: (HttpRequest, Any) -> HttpResponse
84+
self._serialize.client_side_validation = False
85+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.attached_database_configurations = AttachedDatabaseConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize)
89+
self.managed_private_endpoints = ManagedPrivateEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
90+
self.database_principal_assignments = DatabasePrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize)
91+
self.scripts = ScriptsOperations(self._client, self._config, self._serialize, self._deserialize)
92+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
93+
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
94+
self.data_connections = DataConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
95+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
96+
self.operations_results = OperationsResultsOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.operations_results_location = OperationsResultsLocationOperations(self._client, self._config, self._serialize, self._deserialize)
98+
99+
100+
def _send_request(
101+
self,
102+
request, # type: HttpRequest
103+
**kwargs: Any
104+
) -> HttpResponse:
117105
"""Runs the network request through the client's chained policies.
118106
119-
:param http_request: The network request you want to make. Required.
120-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
121-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
107+
>>> from azure.core.rest import HttpRequest
108+
>>> request = HttpRequest("GET", "https://www.example.org/")
109+
<HttpRequest [GET], url: 'https://www.example.org/'>
110+
>>> response = client._send_request(request)
111+
<HttpResponse: 200 OK>
112+
113+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
114+
115+
:param request: The network request you want to make. Required.
116+
:type request: ~azure.core.rest.HttpRequest
117+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
122118
:return: The response of your network call. Does not do error handling on your response.
123-
:rtype: ~azure.core.pipeline.transport.HttpResponse
119+
:rtype: ~azure.core.rest.HttpResponse
124120
"""
125-
path_format_arguments = {
126-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
127-
}
128-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
129-
stream = kwargs.pop("stream", True)
130-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
131-
return pipeline_response.http_response
121+
122+
request_copy = deepcopy(request)
123+
request_copy.url = self._client.format_url(request_copy.url)
124+
return self._client.send_request(request_copy, **kwargs)
132125

133126
def close(self):
134127
# type: () -> None

0 commit comments

Comments
 (0)