Skip to content

Commit ab4981c

Browse files
yifan-zhou922msyyc
andauthored
Update Purview catalog SDK for python (Azure#23484)
* update catalog sdk for python * Update CHANGELOG.md * drop py2 * update for ci * Update CHANGELOG.md Co-authored-by: msyyc <[email protected]>
1 parent 82bb6e9 commit ab4981c

File tree

18 files changed

+22934
-11915
lines changed

18 files changed

+22934
-11915
lines changed

sdk/purview/azure-purview-catalog/CHANGELOG.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
# Release History
22

3-
## 1.0.0b3 (Unreleased)
3+
## 1.0.0b3 (2022-03-15)
44

5-
### Features Added
5+
**Bugs Fixed**
66

7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
- Fix `delete_by_guids` to get rid of bad request error #22487
12-
13-
### Other Changes
7+
- Fix `delete_by_guids` to get rid of bad request error #22487
148

159
## 1.0.0b2 (2021-09-29)
1610

sdk/purview/azure-purview-catalog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For
1818

1919
### Prerequisites
2020

21-
- Python 2.7, or 3.6 or later is required to use this package.
21+
- Python 3.6 or later is required to use this package.
2222
- You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package.
2323

2424
#### Create a Purview Resource

sdk/purview/azure-purview-catalog/azure/purview/catalog/__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__ = ['PurviewCatalogClient']
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/purview/azure-purview-catalog/azure/purview/catalog/_configuration.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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
@@ -15,39 +15,42 @@
1515

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

2220

23-
class PurviewCatalogClientConfiguration(Configuration):
21+
class PurviewCatalogClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2422
"""Configuration for PurviewCatalogClient.
2523
2624
Note that all parameters used to create this instance are saved as instance
2725
attributes.
2826
29-
:param endpoint: The catalog endpoint of your Purview account. Example: https://{accountName}.purview.azure.com.
27+
:param endpoint: The catalog endpoint of your Purview account. Example:
28+
https://{accountName}.purview.azure.com.
3029
:type endpoint: str
3130
:param credential: Credential needed for the client to connect to Azure.
3231
:type credential: ~azure.core.credentials.TokenCredential
32+
:keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3335
"""
3436

3537
def __init__(
3638
self,
37-
endpoint, # type: str
38-
credential, # type: "TokenCredential"
39-
**kwargs # type: Any
40-
):
41-
# type: (...) -> None
39+
endpoint: str,
40+
credential: "TokenCredential",
41+
**kwargs: Any
42+
) -> None:
43+
super(PurviewCatalogClientConfiguration, self).__init__(**kwargs)
44+
api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str
45+
4246
if endpoint is None:
4347
raise ValueError("Parameter 'endpoint' must not be None.")
4448
if credential is None:
4549
raise ValueError("Parameter 'credential' must not be None.")
46-
super(PurviewCatalogClientConfiguration, self).__init__(**kwargs)
4750

4851
self.endpoint = endpoint
4952
self.credential = credential
50-
self.api_version = "2021-05-01-preview"
53+
self.api_version = api_version
5154
self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default'])
5255
kwargs.setdefault('sdk_moniker', 'purview-catalog/{}'.format(VERSION))
5356
self._configure(**kwargs)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
#
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
#
6+
# The MIT License (MIT)
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the ""Software""), to
10+
# deal in the Software without restriction, including without limitation the
11+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12+
# sell copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24+
# IN THE SOFTWARE.
25+
#
26+
# --------------------------------------------------------------------------
27+
28+
# This file is used for handwritten extensions to the generated code. Example:
29+
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
30+
def patch_sdk():
31+
pass

sdk/purview/azure-purview-catalog/azure/purview/catalog/_purview_catalog_client.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,27 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import TYPE_CHECKING
10+
from typing import Any, TYPE_CHECKING
1111

12-
from azure.core import PipelineClient
1312
from msrest import Deserializer, Serializer
1413

14+
from azure.core import PipelineClient
15+
from azure.core.rest import HttpRequest, HttpResponse
16+
1517
from ._configuration import PurviewCatalogClientConfiguration
1618
from .operations import CollectionOperations, DiscoveryOperations, EntityOperations, GlossaryOperations, LineageOperations, RelationshipOperations, TypesOperations
1719

1820
if TYPE_CHECKING:
1921
# pylint: disable=unused-import,ungrouped-imports
20-
from typing import Any, Dict, Optional
22+
from typing import Dict
2123

2224
from azure.core.credentials import TokenCredential
23-
from azure.core.rest import HttpRequest, HttpResponse
2425

25-
class PurviewCatalogClient(object):
26-
"""Purview Catalog Service is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Catalog helps organizations get more value from their existing investments. This spec defines REST API of Purview Catalog Service.
26+
class PurviewCatalogClient: # pylint: disable=too-many-instance-attributes
27+
"""Purview Catalog Service is a fully managed cloud service whose users can discover the data
28+
sources they need and understand the data sources they find. At the same time, Data Catalog
29+
helps organizations get more value from their existing investments. This spec defines REST API
30+
of Purview Catalog Service.
2731
2832
:ivar entity: EntityOperations operations
2933
:vartype entity: azure.purview.catalog.operations.EntityOperations
@@ -44,19 +48,21 @@ class PurviewCatalogClient(object):
4448
:type endpoint: str
4549
:param credential: Credential needed for the client to connect to Azure.
4650
:type credential: ~azure.core.credentials.TokenCredential
51+
:keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding
52+
this default value may result in unsupported behavior.
53+
:paramtype api_version: str
4754
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4855
Retry-After header is present.
4956
"""
5057

5158
def __init__(
5259
self,
53-
endpoint, # type: str
54-
credential, # type: "TokenCredential"
55-
**kwargs # type: Any
56-
):
57-
# type: (...) -> None
60+
endpoint: str,
61+
credential: "TokenCredential",
62+
**kwargs: Any
63+
) -> None:
5864
_endpoint = '{Endpoint}/catalog/api'
59-
self._config = PurviewCatalogClientConfiguration(endpoint, credential, **kwargs)
65+
self._config = PurviewCatalogClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
6066
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
6167

6268
self._serialize = Serializer()
@@ -73,10 +79,9 @@ def __init__(
7379

7480
def send_request(
7581
self,
76-
request, # type: HttpRequest
77-
**kwargs # type: Any
78-
):
79-
# type: (...) -> HttpResponse
82+
request: HttpRequest,
83+
**kwargs: Any
84+
) -> HttpResponse:
8085
"""Runs the network request through the client's chained policies.
8186
8287
>>> from azure.core.rest import HttpRequest

sdk/purview/azure-purview-catalog/azure/purview/catalog/_vendor.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
66
# --------------------------------------------------------------------------
77

8-
from azure.core.pipeline.transport import HttpRequest
98

10-
def _convert_request(request, files=None):
11-
data = request.content if not files else None
12-
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
13-
if files:
14-
request.set_formdata_body(files)
15-
return request
9+
1610

1711
def _format_url_section(template, **kwargs):
1812
components = template.split("/")

sdk/purview/azure-purview-catalog/azure/purview/catalog/aio/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88

99
from ._purview_catalog_client import PurviewCatalogClient
1010
__all__ = ['PurviewCatalogClient']
11+
12+
# `._patch.py` is used for handwritten extensions to the generated code
13+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
14+
from ._patch import patch_sdk
15+
patch_sdk()

sdk/purview/azure-purview-catalog/azure/purview/catalog/aio/_configuration.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@
1818
from azure.core.credentials_async import AsyncTokenCredential
1919

2020

21-
class PurviewCatalogClientConfiguration(Configuration):
21+
class PurviewCatalogClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2222
"""Configuration for PurviewCatalogClient.
2323
2424
Note that all parameters used to create this instance are saved as instance
2525
attributes.
2626
27-
:param endpoint: The catalog endpoint of your Purview account. Example: https://{accountName}.purview.azure.com.
27+
:param endpoint: The catalog endpoint of your Purview account. Example:
28+
https://{accountName}.purview.azure.com.
2829
:type endpoint: str
2930
:param credential: Credential needed for the client to connect to Azure.
3031
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
32+
:keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3135
"""
3236

3337
def __init__(
@@ -36,15 +40,17 @@ def __init__(
3640
credential: "AsyncTokenCredential",
3741
**kwargs: Any
3842
) -> None:
43+
super(PurviewCatalogClientConfiguration, self).__init__(**kwargs)
44+
api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str
45+
3946
if endpoint is None:
4047
raise ValueError("Parameter 'endpoint' must not be None.")
4148
if credential is None:
4249
raise ValueError("Parameter 'credential' must not be None.")
43-
super(PurviewCatalogClientConfiguration, self).__init__(**kwargs)
4450

4551
self.endpoint = endpoint
4652
self.credential = credential
47-
self.api_version = "2021-05-01-preview"
53+
self.api_version = api_version
4854
self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default'])
4955
kwargs.setdefault('sdk_moniker', 'purview-catalog/{}'.format(VERSION))
5056
self._configure(**kwargs)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
#
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
#
6+
# The MIT License (MIT)
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the ""Software""), to
10+
# deal in the Software without restriction, including without limitation the
11+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12+
# sell copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24+
# IN THE SOFTWARE.
25+
#
26+
# --------------------------------------------------------------------------
27+
28+
# This file is used for handwritten extensions to the generated code. Example:
29+
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
30+
def patch_sdk():
31+
pass

0 commit comments

Comments
 (0)