Skip to content

Commit

Permalink
[AutoRelease] t2-confidentialledger-2023-04-20-73907(can only be merg…
Browse files Browse the repository at this point in the history
…ed by SDK owner) (#29977)

* code and test

* Update CHANGELOG.md

---------

Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: Yuchao Yan <[email protected]>
  • Loading branch information
azure-sdk and msyyc authored Apr 20, 2023
1 parent bbfc079 commit 7c11ee0
Show file tree
Hide file tree
Showing 37 changed files with 3,276 additions and 335 deletions.
12 changes: 12 additions & 0 deletions sdk/confidentialledger/azure-mgmt-confidentialledger/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release History

## 2.0.0b2 (2023-04-20)

### Features Added

- Added operation group ManagedCCFOperations
- Model LedgerProperties has a new parameter running_state

### Breaking Changes

- Model LedgerProperties no longer has parameter ledger_storage_account
- Parameter location of model ConfidentialLedger is now required

## 2.0.0b1 (2022-11-25)

### Features Added
Expand Down
50 changes: 43 additions & 7 deletions sdk/confidentialledger/azure-mgmt-confidentialledger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,53 @@ For a more complete view of Azure libraries, see the [azure sdk python release](

_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_

# Usage
## Getting started

### Prerequisites

To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)

For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Confidential Ledger Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
- Python 3.7+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

# Provide Feedback
```bash
pip install azure-mgmt-confidentialledger
pip install azure-identity
```

### Authentication

By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` for Azure client secret.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.

With above configuration, client can be authenticated by following code:

```python
from azure.identity import DefaultAzureCredential
from azure.mgmt.confidentialledger import ConfidentialLedger
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = ConfidentialLedger(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Examples

Code samples for this package can be found at:
- [Search Confidential Ledger Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


## Troubleshooting

## Next steps

## Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "1fefe3f5cee88319b17c08a2dbf95e1e983a9f8c",
"commit": "00ff897270e1f60b5e8944b15fc35fc0f9af2598",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.2.7",
"@autorest/python@6.4.8",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/confidentialledger/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 --tag=package-2020-12-01-preview --use=@autorest/python@6.2.7 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/confidentialledger/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.4.8 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/confidentialledger/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@
from . import models as _models
from ._configuration import ConfidentialLedgerConfiguration
from ._serialization import Deserializer, Serializer
from .operations import LedgerOperations, Operations
from .operations import ConfidentialLedgerOperationsMixin, LedgerOperations, ManagedCCFOperations, Operations

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


class ConfidentialLedger: # pylint: disable=client-accepts-api-version-keyword
class ConfidentialLedger(ConfidentialLedgerOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
"""Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.confidentialledger.operations.Operations
:ivar ledger: LedgerOperations operations
:vartype ledger: azure.mgmt.confidentialledger.operations.LedgerOperations
:ivar managed_ccf: ManagedCCFOperations operations
:vartype managed_ccf: azure.mgmt.confidentialledger.operations.ManagedCCFOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2020-12-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-01-26-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -51,14 +52,15 @@ def __init__(
**kwargs: Any
) -> None:
self._config = ConfidentialLedgerConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.ledger = LedgerOperations(self._client, self._config, self._serialize, self._deserialize)
self.managed_ccf = ManagedCCFOperations(self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
Expand Down Expand Up @@ -89,5 +91,5 @@ def __enter__(self) -> "ConfidentialLedger":
self._client.__enter__()
return self

def __exit__(self, *exc_details) -> 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 @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -33,17 +27,16 @@ class ConfidentialLedgerConfiguration(Configuration): # pylint: disable=too-man
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
00000000-0000-0000-0000-000000000000). Required.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2020-12-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-01-26-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(ConfidentialLedgerConfiguration, self).__init__(**kwargs)
api_version: Literal["2020-12-01-preview"] = kwargs.pop("api_version", "2020-12-01-preview")
api_version: str = kwargs.pop("api_version", "2023-01-26-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Loading

0 comments on commit 7c11ee0

Please sign in to comment.