Skip to content

Commit a534418

Browse files
azure-sdkmsyyc
andauthored
[AutoRelease] t2-datalake-store-2023-02-16-99155(can only be merged by SDK owner) (Azure#28856)
* code and test * Update CHANGELOG.md * Update _version.py --------- Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: Yuchao Yan <[email protected]>
1 parent f79ef47 commit a534418

File tree

64 files changed

+10045
-5435
lines changed

Some content is hidden

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

64 files changed

+10045
-5435
lines changed

sdk/datalake/azure-mgmt-datalake-store/CHANGELOG.md

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

3+
## 1.1.0b1 (2023-02-16)
4+
5+
### Features Added
6+
7+
- Added model CheckNameAvailabilityParametersType
8+
39
## 1.0.0 (2020-12-21)
410

511
**Breaking changes**

sdk/datalake/azure-mgmt-datalake-store/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
22
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py

sdk/datalake/azure-mgmt-datalake-store/README.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release](
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/data-lake-store)
17-
Code samples for this package can be found at [Data Lake Store 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/datalakestore)
15+
- Python 3.7+ 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-datalake-store
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.datalake.store import DataLakeStoreAccountManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = DataLakeStoreAccountManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
49+
Code samples for this package can be found at [Data Lake Store Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
50+
51+
52+
## Troubleshooting
53+
54+
## Next steps
55+
56+
## Provide Feedback
2257

2358
If you encounter any bugs or have suggestions, please file an issue in the
2459
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commit": "b64c34315bed61363cd4032f1bff1a0b246da490",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"autorest": "3.9.2",
5+
"use": [
6+
"@autorest/[email protected]",
7+
"@autorest/[email protected]"
8+
],
9+
"autorest_command": "autorest specification/datalake-store/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
10+
"readme": "specification/datalake-store/resource-manager/readme.md"
11+
}

sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['DataLakeStoreAccountManagementClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = [
22+
"DataLakeStoreAccountManagementClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()

sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_configuration.py

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

9-
from typing import TYPE_CHECKING
9+
import sys
10+
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
1213
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1415

1516
from ._version import VERSION
1617

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+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2125
from azure.core.credentials import TokenCredential
2226

2327

24-
class DataLakeStoreAccountManagementClientConfiguration(Configuration):
28+
class DataLakeStoreAccountManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2529
"""Configuration for DataLakeStoreAccountManagementClient.
2630
2731
Note that all parameters used to create this instance are saved as instance
2832
attributes.
2933
30-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
3135
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
36+
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
37+
subscription. The subscription ID forms part of the URI for every service call. Required.
3338
:type subscription_id: str
39+
:keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this
40+
default value may result in unsupported behavior.
41+
:paramtype api_version: str
3442
"""
3543

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
44+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45+
super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs)
46+
api_version: Literal["2016-11-01"] = kwargs.pop("api_version", "2016-11-01")
47+
4348
if credential is None:
4449
raise ValueError("Parameter 'credential' must not be None.")
4550
if subscription_id is None:
4651
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(DataLakeStoreAccountManagementClientConfiguration, self).__init__(**kwargs)
4852

4953
self.credential = credential
5054
self.subscription_id = subscription_id
51-
self.api_version = "2016-11-01"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-datalake-store/{}'.format(VERSION))
55+
self.api_version = api_version
56+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
57+
kwargs.setdefault("sdk_moniker", "mgmt-datalake-store/{}".format(VERSION))
5458
self._configure(**kwargs)
5559

56-
def _configure(
57-
self,
58-
**kwargs # type: Any
59-
):
60-
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
self.authentication_policy = kwargs.get('authentication_policy')
60+
def _configure(self, **kwargs: Any) -> None:
61+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
62+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
63+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
64+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
65+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
66+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
67+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
68+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
69+
self.authentication_policy = kwargs.get("authentication_policy")
7070
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
71+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
72+
self.credential, *self.credential_scopes, **kwargs
73+
)

sdk/datalake/azure-mgmt-datalake-store/azure/mgmt/datalake/store/_data_lake_store_account_management_client.py

Lines changed: 74 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,90 +6,115 @@
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, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models as _models
16+
from ._configuration import DataLakeStoreAccountManagementClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AccountsOperations,
20+
FirewallRulesOperations,
21+
LocationsOperations,
22+
Operations,
23+
TrustedIdProvidersOperations,
24+
VirtualNetworkRulesOperations,
25+
)
1326

1427
if TYPE_CHECKING:
1528
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1829
from azure.core.credentials import TokenCredential
1930

20-
from ._configuration import DataLakeStoreAccountManagementClientConfiguration
21-
from .operations import AccountsOperations
22-
from .operations import FirewallRulesOperations
23-
from .operations import VirtualNetworkRulesOperations
24-
from .operations import TrustedIdProvidersOperations
25-
from .operations import Operations
26-
from .operations import LocationsOperations
27-
from . import models
2831

29-
30-
class DataLakeStoreAccountManagementClient(object):
32+
class DataLakeStoreAccountManagementClient: # pylint: disable=client-accepts-api-version-keyword
3133
"""Creates an Azure Data Lake Store account management client.
3234
3335
:ivar accounts: AccountsOperations operations
3436
:vartype accounts: azure.mgmt.datalake.store.operations.AccountsOperations
3537
:ivar firewall_rules: FirewallRulesOperations operations
3638
:vartype firewall_rules: azure.mgmt.datalake.store.operations.FirewallRulesOperations
3739
:ivar virtual_network_rules: VirtualNetworkRulesOperations operations
38-
:vartype virtual_network_rules: azure.mgmt.datalake.store.operations.VirtualNetworkRulesOperations
40+
:vartype virtual_network_rules:
41+
azure.mgmt.datalake.store.operations.VirtualNetworkRulesOperations
3942
:ivar trusted_id_providers: TrustedIdProvidersOperations operations
40-
:vartype trusted_id_providers: azure.mgmt.datalake.store.operations.TrustedIdProvidersOperations
43+
:vartype trusted_id_providers:
44+
azure.mgmt.datalake.store.operations.TrustedIdProvidersOperations
4145
:ivar operations: Operations operations
4246
:vartype operations: azure.mgmt.datalake.store.operations.Operations
4347
:ivar locations: LocationsOperations operations
4448
:vartype locations: azure.mgmt.datalake.store.operations.LocationsOperations
45-
:param credential: Credential needed for the client to connect to Azure.
49+
:param credential: Credential needed for the client to connect to Azure. Required.
4650
:type credential: ~azure.core.credentials.TokenCredential
47-
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
51+
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
52+
subscription. The subscription ID forms part of the URI for every service call. Required.
4853
:type subscription_id: str
49-
:param str base_url: Service URL
50-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
54+
:param base_url: Service URL. Default value is "https://management.azure.com".
55+
:type base_url: str
56+
:keyword api_version: Api Version. Default value is "2016-11-01". Note that overriding this
57+
default value may result in unsupported behavior.
58+
:paramtype api_version: str
59+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
60+
Retry-After header is present.
5161
"""
5262

5363
def __init__(
5464
self,
55-
credential, # type: "TokenCredential"
56-
subscription_id, # type: str
57-
base_url=None, # type: Optional[str]
58-
**kwargs # type: Any
59-
):
60-
# type: (...) -> None
61-
if not base_url:
62-
base_url = 'https://management.azure.com'
63-
self._config = DataLakeStoreAccountManagementClientConfiguration(credential, subscription_id, **kwargs)
65+
credential: "TokenCredential",
66+
subscription_id: str,
67+
base_url: str = "https://management.azure.com",
68+
**kwargs: Any
69+
) -> None:
70+
self._config = DataLakeStoreAccountManagementClientConfiguration(
71+
credential=credential, subscription_id=subscription_id, **kwargs
72+
)
6473
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6574

66-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
75+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
6776
self._serialize = Serializer(client_models)
68-
self._serialize.client_side_validation = False
6977
self._deserialize = Deserializer(client_models)
70-
71-
self.accounts = AccountsOperations(
72-
self._client, self._config, self._serialize, self._deserialize)
73-
self.firewall_rules = FirewallRulesOperations(
74-
self._client, self._config, self._serialize, self._deserialize)
78+
self._serialize.client_side_validation = False
79+
self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
80+
self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize)
7581
self.virtual_network_rules = VirtualNetworkRulesOperations(
76-
self._client, self._config, self._serialize, self._deserialize)
82+
self._client, self._config, self._serialize, self._deserialize
83+
)
7784
self.trusted_id_providers = TrustedIdProvidersOperations(
78-
self._client, self._config, self._serialize, self._deserialize)
79-
self.operations = Operations(
80-
self._client, self._config, self._serialize, self._deserialize)
81-
self.locations = LocationsOperations(
82-
self._client, self._config, self._serialize, self._deserialize)
83-
84-
def close(self):
85-
# type: () -> None
85+
self._client, self._config, self._serialize, self._deserialize
86+
)
87+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
88+
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
89+
90+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
91+
"""Runs the network request through the client's chained policies.
92+
93+
>>> from azure.core.rest import HttpRequest
94+
>>> request = HttpRequest("GET", "https://www.example.org/")
95+
<HttpRequest [GET], url: 'https://www.example.org/'>
96+
>>> response = client._send_request(request)
97+
<HttpResponse: 200 OK>
98+
99+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
100+
101+
:param request: The network request you want to make. Required.
102+
:type request: ~azure.core.rest.HttpRequest
103+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
104+
:return: The response of your network call. Does not do error handling on your response.
105+
:rtype: ~azure.core.rest.HttpResponse
106+
"""
107+
108+
request_copy = deepcopy(request)
109+
request_copy.url = self._client.format_url(request_copy.url)
110+
return self._client.send_request(request_copy, **kwargs)
111+
112+
def close(self) -> None:
86113
self._client.close()
87114

88-
def __enter__(self):
89-
# type: () -> DataLakeStoreAccountManagementClient
115+
def __enter__(self) -> "DataLakeStoreAccountManagementClient":
90116
self._client.__enter__()
91117
return self
92118

93-
def __exit__(self, *exc_details):
94-
# type: (Any) -> None
119+
def __exit__(self, *exc_details: Any) -> None:
95120
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)