Skip to content

Commit 7f7c75a

Browse files
author
SDKAuto
committed
CodeGen from PR 28792 in Azure/azure-rest-api-specs
Merge ecf736f5936839b8ca4c48d5541a92c12a35954a into a9ace5a76360f440e64d943c5526deca90260c7c
1 parent c7bf17c commit 7f7c75a

File tree

63 files changed

+5692
-2134
lines changed

Some content is hidden

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

63 files changed

+5692
-2134
lines changed

sdk/purview/azure-mgmt-purview/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 Purview 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 [Purview 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.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-purview
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.purview import PurviewManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = PurviewManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Purview 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-purview%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "65467c71b96b9fae47ed74d9866a3494030336d4",
2+
"commit": "42f86979ad0554ccf60fc09c53d744493b3865f4",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.2.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.13.7",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/purview/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.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/purview/resource-manager/readme.md --generate-sample=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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/purview/resource-manager/readme.md"
1111
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk

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

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,19 @@
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:
2417
# pylint: disable=unused-import,ungrouped-imports
2518
from azure.core.credentials import TokenCredential
2619

2720

28-
class PurviewManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class PurviewManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2922
"""Configuration for PurviewManagementClient.
3023
3124
Note that all parameters used to create this instance are saved as instance
@@ -35,14 +28,13 @@ class PurviewManagementClientConfiguration(Configuration): # pylint: disable=to
3528
:type credential: ~azure.core.credentials.TokenCredential
3629
:param subscription_id: The subscription identifier. Required.
3730
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this
39-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-04-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
4033
:paramtype api_version: str
4134
"""
4235

4336
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
44-
super(PurviewManagementClientConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"]
37+
api_version: str = kwargs.pop("api_version", "2024-04-01-preview")
4638

4739
if credential is None:
4840
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,20 +46,18 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5446
self.api_version = api_version
5547
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5648
kwargs.setdefault("sdk_moniker", "mgmt-purview/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5750
self._configure(**kwargs)
5851

59-
def _configure(
60-
self, **kwargs # type: Any
61-
):
62-
# type: (...) -> None
52+
def _configure(self, **kwargs: Any) -> None:
6353
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6454
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6555
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6656
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6757
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
68-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6958
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
7059
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
7161
self.authentication_policy = kwargs.get("authentication_policy")
7262
if self.credential and not self.authentication_policy:
7363
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_purview_management_client.py

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,63 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12+
from azure.core.pipeline import policies
1213
from azure.core.rest import HttpRequest, HttpResponse
1314
from azure.mgmt.core import ARMPipelineClient
15+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1416

15-
from . import models
17+
from . import models as _models
1618
from ._configuration import PurviewManagementClientConfiguration
1719
from ._serialization import Deserializer, Serializer
1820
from .operations import (
1921
AccountsOperations,
2022
DefaultAccountsOperations,
23+
FeaturesOperations,
24+
IngestionPrivateEndpointConnectionsOperations,
25+
KafkaConfigurationsOperations,
2126
Operations,
2227
PrivateEndpointConnectionsOperations,
2328
PrivateLinkResourcesOperations,
29+
UsagesOperations,
2430
)
2531

2632
if TYPE_CHECKING:
2733
# pylint: disable=unused-import,ungrouped-imports
2834
from azure.core.credentials import TokenCredential
2935

3036

31-
class PurviewManagementClient: # pylint: disable=client-accepts-api-version-keyword
37+
class PurviewManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3238
"""Creates a Microsoft.Purview management client.
3339
3440
:ivar accounts: AccountsOperations operations
3541
:vartype accounts: azure.mgmt.purview.operations.AccountsOperations
3642
:ivar default_accounts: DefaultAccountsOperations operations
3743
:vartype default_accounts: azure.mgmt.purview.operations.DefaultAccountsOperations
44+
:ivar features: FeaturesOperations operations
45+
:vartype features: azure.mgmt.purview.operations.FeaturesOperations
46+
:ivar ingestion_private_endpoint_connections: IngestionPrivateEndpointConnectionsOperations
47+
operations
48+
:vartype ingestion_private_endpoint_connections:
49+
azure.mgmt.purview.operations.IngestionPrivateEndpointConnectionsOperations
50+
:ivar kafka_configurations: KafkaConfigurationsOperations operations
51+
:vartype kafka_configurations: azure.mgmt.purview.operations.KafkaConfigurationsOperations
3852
:ivar operations: Operations operations
3953
:vartype operations: azure.mgmt.purview.operations.Operations
4054
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
4155
:vartype private_endpoint_connections:
4256
azure.mgmt.purview.operations.PrivateEndpointConnectionsOperations
4357
:ivar private_link_resources: PrivateLinkResourcesOperations operations
4458
:vartype private_link_resources: azure.mgmt.purview.operations.PrivateLinkResourcesOperations
59+
:ivar usages: UsagesOperations operations
60+
:vartype usages: azure.mgmt.purview.operations.UsagesOperations
4561
:param credential: Credential needed for the client to connect to Azure. Required.
4662
:type credential: ~azure.core.credentials.TokenCredential
4763
:param subscription_id: The subscription identifier. Required.
4864
:type subscription_id: str
4965
:param base_url: Service URL. Default value is "https://management.azure.com".
5066
:type base_url: str
51-
:keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this
52-
default value may result in unsupported behavior.
67+
:keyword api_version: Api Version. Default value is "2024-04-01-preview". Note that overriding
68+
this default value may result in unsupported behavior.
5369
:paramtype api_version: str
5470
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5571
Retry-After header is present.
@@ -65,25 +81,51 @@ def __init__(
6581
self._config = PurviewManagementClientConfiguration(
6682
credential=credential, subscription_id=subscription_id, **kwargs
6783
)
68-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
69-
70-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
84+
_policies = kwargs.pop("policies", None)
85+
if _policies is None:
86+
_policies = [
87+
policies.RequestIdPolicy(**kwargs),
88+
self._config.headers_policy,
89+
self._config.user_agent_policy,
90+
self._config.proxy_policy,
91+
policies.ContentDecodePolicy(**kwargs),
92+
ARMAutoResourceProviderRegistrationPolicy(),
93+
self._config.redirect_policy,
94+
self._config.retry_policy,
95+
self._config.authentication_policy,
96+
self._config.custom_hook_policy,
97+
self._config.logging_policy,
98+
policies.DistributedTracingPolicy(**kwargs),
99+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
100+
self._config.http_logging_policy,
101+
]
102+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
103+
104+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
71105
self._serialize = Serializer(client_models)
72106
self._deserialize = Deserializer(client_models)
73107
self._serialize.client_side_validation = False
74108
self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
75109
self.default_accounts = DefaultAccountsOperations(
76110
self._client, self._config, self._serialize, self._deserialize
77111
)
112+
self.features = FeaturesOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.ingestion_private_endpoint_connections = IngestionPrivateEndpointConnectionsOperations(
114+
self._client, self._config, self._serialize, self._deserialize
115+
)
116+
self.kafka_configurations = KafkaConfigurationsOperations(
117+
self._client, self._config, self._serialize, self._deserialize
118+
)
78119
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
79120
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
80121
self._client, self._config, self._serialize, self._deserialize
81122
)
82123
self.private_link_resources = PrivateLinkResourcesOperations(
83124
self._client, self._config, self._serialize, self._deserialize
84125
)
126+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
85127

86-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
128+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
87129
"""Runs the network request through the client's chained policies.
88130
89131
>>> from azure.core.rest import HttpRequest
@@ -103,17 +145,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
103145

104146
request_copy = deepcopy(request)
105147
request_copy.url = self._client.format_url(request_copy.url)
106-
return self._client.send_request(request_copy, **kwargs)
148+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
107149

108-
def close(self):
109-
# type: () -> None
150+
def close(self) -> None:
110151
self._client.close()
111152

112-
def __enter__(self):
113-
# type: () -> PurviewManagementClient
153+
def __enter__(self) -> "PurviewManagementClient":
114154
self._client.__enter__()
115155
return self
116156

117-
def __exit__(self, *exc_details):
118-
# type: (Any) -> None
157+
def __exit__(self, *exc_details: Any) -> None:
119158
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)