Skip to content

Commit 79dcd4c

Browse files
author
SDKAuto
committed
CodeGen from PR 34006 in Azure/azure-rest-api-specs
Merge 9db6d05aa9250b2c944c5b29ea1883674ca54dec into 9f43656894d4026c725a80f62dd582174a500053
1 parent c59cfb6 commit 79dcd4c

File tree

131 files changed

+27197
-3775
lines changed

Some content is hidden

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

131 files changed

+27197
-3775
lines changed
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 Azure Arc Data Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.9+.
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 [Azure Arc Data 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://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.9+ 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-azurearcdata
22+
pip install azure-identity
23+
```
2224

23-
If you encounter any bugs or have suggestions, please file an issue in the
24-
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
25-
section of the project.
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the 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.azurearcdata import AzureArcDataManagementClient
40+
import os
2641

42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = AzureArcDataManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
2745

46+
## Examples
2847

48+
Code samples for this package can be found at:
49+
- [Search Azure Arc Data 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
58+
59+
If you encounter any bugs or have suggestions, please file an issue in the
60+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
61+
section of the project.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "be6cd9ccfcb6ba08c1c206627026eabfbff31fc1",
2+
"commit": "7bc574d79bbe9e40e5c4b4ffb9da16c0f1075939",
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.32.3",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/azurearcdata/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/azurearcdata/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.32.3 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/azurearcdata/resource-manager/readme.md"
1111
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._azure_arc_data_management_client import AzureArcDataManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._azure_arc_data_management_client import AzureArcDataManagementClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"AzureArcDataManagementClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,35 @@
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 AzureArcDataManagementClientConfiguration
1720
from ._serialization import Deserializer, Serializer
1821
from .operations import (
1922
ActiveDirectoryConnectorsOperations,
2023
DataControllersOperations,
24+
FailoverGroupsOperations,
2125
Operations,
2226
PostgresInstancesOperations,
2327
SqlManagedInstancesOperations,
28+
SqlServerAvailabilityGroupsOperations,
29+
SqlServerDatabasesOperations,
30+
SqlServerEsuLicensesOperations,
2431
SqlServerInstancesOperations,
32+
SqlServerLicensesOperations,
2533
)
2634

2735
if TYPE_CHECKING:
28-
# pylint: disable=unused-import,ungrouped-imports
2936
from azure.core.credentials import TokenCredential
3037

3138

32-
class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-version-keyword
39+
class AzureArcDataManagementClient: # pylint: disable=too-many-instance-attributes
3340
"""The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data
3441
Services on Azure Arc Resources.
3542
@@ -38,22 +45,34 @@ class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-versio
3845
:ivar sql_managed_instances: SqlManagedInstancesOperations operations
3946
:vartype sql_managed_instances:
4047
azure.mgmt.azurearcdata.operations.SqlManagedInstancesOperations
48+
:ivar failover_groups: FailoverGroupsOperations operations
49+
:vartype failover_groups: azure.mgmt.azurearcdata.operations.FailoverGroupsOperations
4150
:ivar sql_server_instances: SqlServerInstancesOperations operations
4251
:vartype sql_server_instances: azure.mgmt.azurearcdata.operations.SqlServerInstancesOperations
52+
:ivar sql_server_licenses: SqlServerLicensesOperations operations
53+
:vartype sql_server_licenses: azure.mgmt.azurearcdata.operations.SqlServerLicensesOperations
4354
:ivar data_controllers: DataControllersOperations operations
4455
:vartype data_controllers: azure.mgmt.azurearcdata.operations.DataControllersOperations
4556
:ivar active_directory_connectors: ActiveDirectoryConnectorsOperations operations
4657
:vartype active_directory_connectors:
4758
azure.mgmt.azurearcdata.operations.ActiveDirectoryConnectorsOperations
4859
:ivar postgres_instances: PostgresInstancesOperations operations
4960
:vartype postgres_instances: azure.mgmt.azurearcdata.operations.PostgresInstancesOperations
61+
:ivar sql_server_availability_groups: SqlServerAvailabilityGroupsOperations operations
62+
:vartype sql_server_availability_groups:
63+
azure.mgmt.azurearcdata.operations.SqlServerAvailabilityGroupsOperations
64+
:ivar sql_server_databases: SqlServerDatabasesOperations operations
65+
:vartype sql_server_databases: azure.mgmt.azurearcdata.operations.SqlServerDatabasesOperations
66+
:ivar sql_server_esu_licenses: SqlServerEsuLicensesOperations operations
67+
:vartype sql_server_esu_licenses:
68+
azure.mgmt.azurearcdata.operations.SqlServerEsuLicensesOperations
5069
:param credential: Credential needed for the client to connect to Azure. Required.
5170
:type credential: ~azure.core.credentials.TokenCredential
5271
:param subscription_id: The ID of the Azure subscription. Required.
5372
:type subscription_id: str
5473
:param base_url: Service URL. Default value is "https://management.azure.com".
5574
:type base_url: str
56-
:keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding
75+
:keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding
5776
this default value may result in unsupported behavior.
5877
:paramtype api_version: str
5978
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -70,7 +89,25 @@ def __init__(
7089
self._config = AzureArcDataManagementClientConfiguration(
7190
credential=credential, subscription_id=subscription_id, **kwargs
7291
)
73-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
92+
_policies = kwargs.pop("policies", None)
93+
if _policies is None:
94+
_policies = [
95+
policies.RequestIdPolicy(**kwargs),
96+
self._config.headers_policy,
97+
self._config.user_agent_policy,
98+
self._config.proxy_policy,
99+
policies.ContentDecodePolicy(**kwargs),
100+
ARMAutoResourceProviderRegistrationPolicy(),
101+
self._config.redirect_policy,
102+
self._config.retry_policy,
103+
self._config.authentication_policy,
104+
self._config.custom_hook_policy,
105+
self._config.logging_policy,
106+
policies.DistributedTracingPolicy(**kwargs),
107+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
108+
self._config.http_logging_policy,
109+
]
110+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
74111

75112
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
76113
self._serialize = Serializer(client_models)
@@ -80,9 +117,13 @@ def __init__(
80117
self.sql_managed_instances = SqlManagedInstancesOperations(
81118
self._client, self._config, self._serialize, self._deserialize
82119
)
120+
self.failover_groups = FailoverGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
83121
self.sql_server_instances = SqlServerInstancesOperations(
84122
self._client, self._config, self._serialize, self._deserialize
85123
)
124+
self.sql_server_licenses = SqlServerLicensesOperations(
125+
self._client, self._config, self._serialize, self._deserialize
126+
)
86127
self.data_controllers = DataControllersOperations(
87128
self._client, self._config, self._serialize, self._deserialize
88129
)
@@ -92,8 +133,17 @@ def __init__(
92133
self.postgres_instances = PostgresInstancesOperations(
93134
self._client, self._config, self._serialize, self._deserialize
94135
)
136+
self.sql_server_availability_groups = SqlServerAvailabilityGroupsOperations(
137+
self._client, self._config, self._serialize, self._deserialize
138+
)
139+
self.sql_server_databases = SqlServerDatabasesOperations(
140+
self._client, self._config, self._serialize, self._deserialize
141+
)
142+
self.sql_server_esu_licenses = SqlServerEsuLicensesOperations(
143+
self._client, self._config, self._serialize, self._deserialize
144+
)
95145

96-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
146+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
97147
"""Runs the network request through the client's chained policies.
98148
99149
>>> from azure.core.rest import HttpRequest
@@ -113,14 +163,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
113163

114164
request_copy = deepcopy(request)
115165
request_copy.url = self._client.format_url(request_copy.url)
116-
return self._client.send_request(request_copy, **kwargs)
166+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
117167

118168
def close(self) -> None:
119169
self._client.close()
120170

121-
def __enter__(self) -> "AzureArcDataManagementClient":
171+
def __enter__(self) -> Self:
122172
self._client.__enter__()
123173
return self
124174

125-
def __exit__(self, *exc_details) -> None:
175+
def __exit__(self, *exc_details: Any) -> None:
126176
self._client.__exit__(*exc_details)

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

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

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
24-
# pylint: disable=unused-import,ungrouped-imports
2517
from azure.core.credentials import TokenCredential
2618

2719

28-
class AzureArcDataManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class AzureArcDataManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2921
"""Configuration for AzureArcDataManagementClient.
3022
3123
Note that all parameters used to create this instance are saved as instance
@@ -35,14 +27,13 @@ class AzureArcDataManagementClientConfiguration(Configuration): # pylint: disab
3527
:type credential: ~azure.core.credentials.TokenCredential
3628
:param subscription_id: The ID of the Azure subscription. Required.
3729
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding
30+
:keyword api_version: Api Version. Default value is "2025-03-01-preview". Note that overriding
3931
this default value may result in unsupported behavior.
4032
:paramtype api_version: str
4133
"""
4234

4335
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(AzureArcDataManagementClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview")
36+
api_version: str = kwargs.pop("api_version", "2025-03-01-preview")
4637

4738
if credential is None:
4839
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5445
self.api_version = api_version
5546
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5647
kwargs.setdefault("sdk_moniker", "mgmt-azurearcdata/{}".format(VERSION))
48+
self.polling_interval = kwargs.get("polling_interval", 30)
5749
self._configure(**kwargs)
5850

5951
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
6254
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6355
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6456
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
65-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6657
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6758
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
59+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6860
self.authentication_policy = kwargs.get("authentication_policy")
6961
if self.credential and not self.authentication_policy:
7062
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)