Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating Python sdk for ACL API version 2024-08-22 #38959

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e77fe81
Generating Python sdk for ACL API version 2024-08-22
amruthashree18 Dec 20, 2024
5d12f2e
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 7, 2025
ef2565d
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 8, 2025
a1c0fe7
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 9, 2025
a27474c
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 10, 2025
806de88
Upgrading azure-core to 1.28.0
amruthashree18 Jan 10, 2025
4b77590
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 13, 2025
573e053
Addressing review comments
amruthashree18 Jan 13, 2025
9a12112
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 17, 2025
7f55847
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 21, 2025
dc0f570
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 22, 2025
b8f0871
Fixing users tests and adding new tests for ledgerUsers endpoint
amruthashree18 Jan 22, 2025
c33e667
Adding prograamability tests
amruthashree18 Jan 22, 2025
98b21db
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 22, 2025
278385b
Recording tests
amruthashree18 Jan 22, 2025
de89342
Merge branch 'amruthashree18/generate_pythonsdk' of https://github.co…
amruthashree18 Jan 22, 2025
d06127e
Reverting test venv setup changes
amruthashree18 Jan 22, 2025
df33c05
Fixing tests
amruthashree18 Jan 22, 2025
b315c67
Fixing tests
amruthashree18 Jan 22, 2025
bd6908b
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 22, 2025
463fdfd
Merge branch 'amruthashree18/generate_pythonsdk' of https://github.co…
amruthashree18 Jan 22, 2025
b90eaa9
Pushing assets
amruthashree18 Jan 23, 2025
763bb3b
Merge branch 'Azure:main' into amruthashree18/generate_pythonsdk
amruthashree18 Jan 23, 2025
939c6ca
Pushing test recordings
amruthashree18 Jan 23, 2025
db8f22b
Merge branch 'amruthashree18/generate_pythonsdk' of https://github.co…
amruthashree18 Jan 23, 2025
584d1e0
Rerecording the tests
amruthashree18 Jan 23, 2025
8bad155
Pushing only recorded tests
amruthashree18 Jan 23, 2025
4f58528
Fix linter issues
taicchoumsft Jan 29, 2025
c46f097
Change the location to AustraliaEast, going forward this is our Test …
taicchoumsft Jan 29, 2025
0f7b97d
Fix the sync tests
taicchoumsft Jan 31, 2025
0c92acb
more fixes to tests
taicchoumsft Jan 31, 2025
e22c5ef
Fix remaining tests
taicchoumsft Jan 31, 2025
e16d9ba
Push new assets
taicchoumsft Jan 31, 2025
dd667c4
Remove debug logging
taicchoumsft Jan 31, 2025
1f6c69a
address PR comments
taicchoumsft Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/confidentialledger/azure-confidentialledger",
"Tag": "python/confidentialledger/azure-confidentialledger_27130e59c6"
"Tag": "python/confidentialledger/azure-confidentialledger_c08331db07"
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._client import ConfidentialLedgerClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import ConfidentialLedgerClient # type: ignore
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["ConfidentialLedgerClient"]
__all__.extend([p for p in _patch_all if p not in __all__])
__all__ = [
"ConfidentialLedgerClient",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,59 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing import Any
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import ConfidentialLedgerClientConfiguration
from ._operations import ConfidentialLedgerClientOperationsMixin
from ._serialization import Deserializer, Serializer

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


class ConfidentialLedgerClient(
ConfidentialLedgerClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
class ConfidentialLedgerClient(ConfidentialLedgerClientOperationsMixin):
"""The ConfidentialLedgerClient writes and retrieves ledger entries against the Confidential
Ledger service.

:param ledger_endpoint: The Confidential Ledger URL, for example
:param endpoint: The Confidential Ledger URL, for example
https://contoso.confidentialledger.azure.com. Required.
:type ledger_endpoint: str
:keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
default value may result in unsupported behavior.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-08-22-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, ledger_endpoint: str, **kwargs: Any
self, endpoint: str, **kwargs: Any
) -> None:
_endpoint = "{ledgerEndpoint}"
self._config = ConfidentialLedgerClientConfiguration(ledger_endpoint=ledger_endpoint, **kwargs)
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
_endpoint = "{endpoint}"
self._config = ConfidentialLedgerClientConfiguration(endpoint=endpoint, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
policies.RequestIdPolicy(**kwargs),
self._config.headers_policy,
self._config.user_agent_policy,
self._config.proxy_policy,
policies.ContentDecodePolicy(**kwargs),
self._config.redirect_policy,
self._config.retry_policy,
self._config.authentication_policy,
self._config.custom_hook_policy,
self._config.logging_policy,
policies.DistributedTracingPolicy(**kwargs),
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False

def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
Expand All @@ -66,23 +79,18 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:

request_copy = deepcopy(request)
path_format_arguments = {
"ledgerEndpoint": self._serialize.url(
"self._config.ledger_endpoint", self._config.ledger_endpoint, "str", skip_quote=True
),
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, **kwargs)
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> ConfidentialLedgerClient
def __enter__(self) -> Self:
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,44 @@

from typing import Any

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION


class ConfidentialLedgerClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class ConfidentialLedgerClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for ConfidentialLedgerClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param ledger_endpoint: The Confidential Ledger URL, for example
:param endpoint: The Confidential Ledger URL, for example
https://contoso.confidentialledger.azure.com. Required.
:type ledger_endpoint: str
:keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
default value may result in unsupported behavior.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-08-22-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

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

if ledger_endpoint is None:
raise ValueError("Parameter 'ledger_endpoint' must not be None.")
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")

self.ledger_endpoint = ledger_endpoint
self.endpoint = endpoint
self.api_version = api_version
kwargs.setdefault("sdk_moniker", "confidentialledger/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._operations import ConfidentialLedgerClientOperationsMixin
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import ConfidentialLedgerClientOperationsMixin # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ConfidentialLedgerClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__])
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Loading