Skip to content

Commit 7bd6787

Browse files
Generating Python sdk for ACL API version 2024-08-22 (Azure#38959)
* Generate Python sdk for ACL API version 2024-08-22 --------- Co-authored-by: Tai Chou <[email protected]>
1 parent 684e761 commit 7bd6787

Some content is hidden

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

45 files changed

+5952
-1878
lines changed

sdk/confidentialledger/azure-confidentialledger/CHANGELOG.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
# Release History
22

3-
## 1.1.2 (Unreleased)
3+
## 1.2.0b1 (Unreleased)
4+
5+
### Features Added
6+
7+
- Add and manage custom roles with the `update_user_defined_role`, `get_user_defined_role` and `delete_user_defined_role` methods
8+
- Add and manage ledger users with the `create_or_update_ledger_user`, `delete_ledger_user`, `get_ledger_user` and `list_ledger_users` methods
9+
- Add and manage programmable endpoints with the `create_user_defined_endpoint` and `get_user_defined_endpoint` methods
10+
- A user can now be associated with more than one role
11+
412
### Other Changes
13+
14+
- A user can now be associated with more than one role
515
- Replace legacy azure core http response import with the one from azure.core.rest
16+
- Developers should opt to use the `*_ledger_user` methods over the `*_user` methods to manage users. The older APIs will be deprecated in the future.
617

718
## 1.1.1 (2023-08-01)
19+
820
### Bugs Fixed
21+
922
- Allow some `ResourceNotFoundError` occurrences in `begin_wait_for_commit` to account for unexpected loss of session stickiness. These errors may occur when the connected node changes and transactions have not been fully replicated.
1023

1124
## 1.1.0 (2023-05-09)
1225

1326
### Features Added
27+
1428
- Add `azure.confidentialledger.receipt` module for Azure Confidential Ledger write transaction receipt verification.
1529
- Add `verify_receipt` function to verify write transaction receipts from a receipt JSON object. The function accepts an optional, keyword-only, list of application claims parameter, which can be used to compute the claims digest from the given claims: the verification would fail if the computed digest value does not match the `claimsDigest` value present in the receipt.
16-
- Add `compute_claims_digest` function to compute the claims digest from a list of application claims JSON objects.
30+
- Add `compute_claims_digest` function to compute the claims digest from a list of application claims JSON objects.
1731
- Add sample code to get and verify a write receipt from a running Confidential Ledger instance.
1832
- Update README with examples and documentation for receipt verification and application claims.
1933

2034
### Other Changes
35+
2136
- Add dependency on Python `cryptography` library (`>= 2.1.4`)
2237
- Add tests for receipt verification models and receipt verification public method.
2338
- Add tests for application claims models and digest computation public method.
@@ -27,16 +42,19 @@
2742
GA Data Plane Python SDK for Confidential Ledger.
2843

2944
### Bugs Fixed
45+
3046
- User ids that are certificate fingerprints are no longer URL-encoded in the request URI.
3147

3248
### Breaking Changes
49+
3350
- Removed all models. Methods now return JSON directly.
3451
- `sub_ledger_id` fields are now named `collection_id`.
3552
- `azure.confidentialledger.identity_service` has been renamed to `azure.confidentialledger.certificate`.
3653
- `ConfidentialLedgerIdentityServiceClient` is now `ConfidentialLedgerCertificateClient`.
3754
- `post_ledger_entry` has been renamed to `create_ledger_entry`.
3855

3956
### Other Changes
57+
4058
- Python 2.7 is no longer supported. Please use Python version 3.7 or later.
4159
- Convenience poller methods added for certain long-running operations.
4260
- Add new supported API version: `2022-05-13`.

sdk/confidentialledger/azure-confidentialledger/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/confidentialledger/azure-confidentialledger",
5-
"Tag": "python/confidentialledger/azure-confidentialledger_27130e59c6"
5+
"Tag": "python/confidentialledger/azure-confidentialledger_c08331db07"
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +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 ._client import ConfidentialLedgerClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import ConfidentialLedgerClient # 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 * # type: ignore # 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

21-
__all__ = ["ConfidentialLedgerClient"]
22-
__all__.extend([p for p in _patch_all if p not in __all__])
27+
__all__ = [
28+
"ConfidentialLedgerClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2331

2432
_patch_sdk()

sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_client.py

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,59 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
14+
from azure.core.pipeline import policies
1315
from azure.core.rest import HttpRequest, HttpResponse
1416

1517
from ._configuration import ConfidentialLedgerClientConfiguration
1618
from ._operations import ConfidentialLedgerClientOperationsMixin
1719
from ._serialization import Deserializer, Serializer
1820

19-
if TYPE_CHECKING:
20-
# pylint: disable=unused-import,ungrouped-imports
21-
from typing import Dict
2221

23-
24-
class ConfidentialLedgerClient(
25-
ConfidentialLedgerClientOperationsMixin
26-
): # pylint: disable=client-accepts-api-version-keyword
22+
class ConfidentialLedgerClient(ConfidentialLedgerClientOperationsMixin):
2723
"""The ConfidentialLedgerClient writes and retrieves ledger entries against the Confidential
2824
Ledger service.
2925
30-
:param ledger_endpoint: The Confidential Ledger URL, for example
26+
:param endpoint: The Confidential Ledger URL, for example
3127
https://contoso.confidentialledger.azure.com. Required.
32-
:type ledger_endpoint: str
33-
:keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
34-
default value may result in unsupported behavior.
28+
:type endpoint: str
29+
:keyword api_version: Api Version. Default value is "2024-08-22-preview". Note that overriding
30+
this default value may result in unsupported behavior.
3531
:paramtype api_version: str
3632
"""
3733

3834
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
39-
self, ledger_endpoint: str, **kwargs: Any
35+
self, endpoint: str, **kwargs: Any
4036
) -> None:
41-
_endpoint = "{ledgerEndpoint}"
42-
self._config = ConfidentialLedgerClientConfiguration(ledger_endpoint=ledger_endpoint, **kwargs)
43-
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
37+
_endpoint = "{endpoint}"
38+
self._config = ConfidentialLedgerClientConfiguration(endpoint=endpoint, **kwargs)
39+
_policies = kwargs.pop("policies", None)
40+
if _policies is None:
41+
_policies = [
42+
policies.RequestIdPolicy(**kwargs),
43+
self._config.headers_policy,
44+
self._config.user_agent_policy,
45+
self._config.proxy_policy,
46+
policies.ContentDecodePolicy(**kwargs),
47+
self._config.redirect_policy,
48+
self._config.retry_policy,
49+
self._config.authentication_policy,
50+
self._config.custom_hook_policy,
51+
self._config.logging_policy,
52+
policies.DistributedTracingPolicy(**kwargs),
53+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
54+
self._config.http_logging_policy,
55+
]
56+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
4457

4558
self._serialize = Serializer()
4659
self._deserialize = Deserializer()
4760
self._serialize.client_side_validation = False
4861

49-
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
62+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
5063
"""Runs the network request through the client's chained policies.
5164
5265
>>> from azure.core.rest import HttpRequest
@@ -66,23 +79,18 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
6679

6780
request_copy = deepcopy(request)
6881
path_format_arguments = {
69-
"ledgerEndpoint": self._serialize.url(
70-
"self._config.ledger_endpoint", self._config.ledger_endpoint, "str", skip_quote=True
71-
),
82+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
7283
}
7384

7485
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
75-
return self._client.send_request(request_copy, **kwargs)
86+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
7687

77-
def close(self):
78-
# type: () -> None
88+
def close(self) -> None:
7989
self._client.close()
8090

81-
def __enter__(self):
82-
# type: () -> ConfidentialLedgerClient
91+
def __enter__(self) -> Self:
8392
self._client.__enter__()
8493
return self
8594

86-
def __exit__(self, *exc_details):
87-
# type: (Any) -> None
95+
def __exit__(self, *exc_details: Any) -> None:
8896
self._client.__exit__(*exc_details)

sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_configuration.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,44 @@
88

99
from typing import Any
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312

1413
from ._version import VERSION
1514

1615

17-
class ConfidentialLedgerClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
16+
class ConfidentialLedgerClientConfiguration: # pylint: disable=too-many-instance-attributes
1817
"""Configuration for ConfidentialLedgerClient.
1918
2019
Note that all parameters used to create this instance are saved as instance
2120
attributes.
2221
23-
:param ledger_endpoint: The Confidential Ledger URL, for example
22+
:param endpoint: The Confidential Ledger URL, for example
2423
https://contoso.confidentialledger.azure.com. Required.
25-
:type ledger_endpoint: str
26-
:keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
27-
default value may result in unsupported behavior.
24+
:type endpoint: str
25+
:keyword api_version: Api Version. Default value is "2024-08-22-preview". Note that overriding
26+
this default value may result in unsupported behavior.
2827
:paramtype api_version: str
2928
"""
3029

31-
def __init__(self, ledger_endpoint: str, **kwargs: Any) -> None:
32-
super(ConfidentialLedgerClientConfiguration, self).__init__(**kwargs)
33-
api_version = kwargs.pop("api_version", "2022-05-13") # type: str
30+
def __init__(self, endpoint: str, **kwargs: Any) -> None:
31+
api_version: str = kwargs.pop("api_version", "2024-08-22-preview")
3432

35-
if ledger_endpoint is None:
36-
raise ValueError("Parameter 'ledger_endpoint' must not be None.")
33+
if endpoint is None:
34+
raise ValueError("Parameter 'endpoint' must not be None.")
3735

38-
self.ledger_endpoint = ledger_endpoint
36+
self.endpoint = endpoint
3937
self.api_version = api_version
4038
kwargs.setdefault("sdk_moniker", "confidentialledger/{}".format(VERSION))
39+
self.polling_interval = kwargs.get("polling_interval", 30)
4140
self._configure(**kwargs)
4241

43-
def _configure(
44-
self, **kwargs # type: Any
45-
):
46-
# type: (...) -> None
42+
def _configure(self, **kwargs: Any) -> None:
4743
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
4844
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
4945
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5046
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5147
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
52-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5348
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5449
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
50+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5551
self.authentication_policy = kwargs.get("authentication_policy")

sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_operations/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@
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 ._operations import ConfidentialLedgerClientOperationsMixin
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._operations import ConfidentialLedgerClientOperationsMixin # type: ignore
1016

1117
from ._patch import __all__ as _patch_all
12-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
18+
from ._patch import *
1319
from ._patch import patch_sdk as _patch_sdk
1420

1521
__all__ = [
1622
"ConfidentialLedgerClientOperationsMixin",
1723
]
18-
__all__.extend([p for p in _patch_all if p not in __all__])
24+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
1925
_patch_sdk()

0 commit comments

Comments
 (0)