Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 47 additions & 0 deletions sdk/attestation/azure-mgmt-attestation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
# Release History

## 2.0.0 (2025-04-25)

### Features Added

- Client `AttestationManagementClient` added operation group `private_endpoint_connections`
- Client `AttestationManagementClient` added operation group `private_link_resources`
- Model `AttestationProvider` added property `system_data`
- Model `AttestationProvider` added property `public_network_access`
- Model `AttestationProvider` added property `private_endpoint_connections`
- Model `AttestationProvider` added property `tpm_attestation_authentication`
- Model `AttestationProviderListResult` added property `system_data`
- Model `AttestationServiceCreationSpecificParams` added property `public_network_access`
- Model `AttestationServiceCreationSpecificParams` added property `tpm_attestation_authentication`
- Model `AttestationServicePatchParams` added property `properties`
- Model `OperationList` added property `system_data`
- Model `OperationsDefinition` added property `properties`
- Added model `AttestationServicePatchSpecificParams`
- Added enum `CreatedByType`
- Added model `LogSpecification`
- Added model `OperationProperties`
- Added model `PrivateEndpoint`
- Added model `PrivateEndpointConnection`
- Added model `PrivateEndpointConnectionListResult`
- Added enum `PrivateEndpointConnectionProvisioningState`
- Added enum `PrivateEndpointServiceConnectionStatus`
- Added model `PrivateLinkResource`
- Added model `PrivateLinkResourceListResult`
- Added model `PrivateLinkServiceConnectionState`
- Added enum `PublicNetworkAccessType`
- Added model `ServiceSpecification`
- Added model `SystemData`
- Added enum `TpmAttestationAuthenticationType`
- Model `AttestationProvidersOperations` added parameter `kwargs` in method `__init__`
- Model `Operations` added parameter `kwargs` in method `__init__`
- Added model `PrivateEndpointConnectionsOperations`
- Added model `PrivateLinkResourcesOperations`
- Method `AttestationProvidersOperations.create` has a new overload `def create(self: None, resource_group_name: str, provider_name: str, creation_params: AttestationServiceCreationParams, content_type: str)`
- Method `AttestationProvidersOperations.create` has a new overload `def create(self: None, resource_group_name: str, provider_name: str, creation_params: IO[bytes], content_type: str)`
- Method `AttestationProvidersOperations.update` has a new overload `def update(self: None, resource_group_name: str, provider_name: str, update_params: AttestationServicePatchParams, content_type: str)`
- Method `AttestationProvidersOperations.update` has a new overload `def update(self: None, resource_group_name: str, provider_name: str, update_params: IO[bytes], content_type: str)`
- Method `PrivateEndpointConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, provider_name: str, private_endpoint_connection_name: str, properties: PrivateEndpointConnection, content_type: str)`
- Method `PrivateEndpointConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, provider_name: str, private_endpoint_connection_name: str, properties: IO[bytes], content_type: str)`

### Breaking Changes

- Model `AttestationServiceCreationSpecificParams` deleted or renamed its instance variable `attestation_policy`

## 2.0.0b1 (2022-10-28)

### Features Added
Expand Down
87 changes: 32 additions & 55 deletions sdk/attestation/azure-mgmt-attestation/README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,61 @@
# Microsoft Azure SDK for Python

This is the Microsoft Azure Attestation Management Client Library.
This package has been tested with Python 3.7+.
This package has been tested with Python 3.9+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).

## _Disclaimer_

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

## Getting Started
## Getting started

### Prerequsites
```shell
pip install azure-identity
### Prerequisites

- Python 3.9+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

```bash
pip install azure-mgmt-attestation
pip install azure-identity
```

Before running the examples, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal

### Authentication

### Resources
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 [Attestation 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)
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.

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

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

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

### List Attestation Providers
```python
from azure.core.exceptions import ClientAuthenticationError
from azure.identity import DefaultAzureCredential
from azure.mgmt.attestation import AttestationManagementClient
import os

client = AttestationManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)

response = client.attestation_providers.list()
print(response)
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = AttestationManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Troubleshooting

### CredentialUnavailableError
The CredentialUnavailableError is a specific error type derived from ClientAuthenticationError. This error type is used to indicate that the credential can't authenticate in the current environment, due to missing required configuration or setup. This error is also used as an indication for chained credential types, such as DefaultAzureCredential and ChainedTokenCredential, that the chained credential should continue to attempt other credential types later in the chain.

### Permission issues
Service client calls that result in HttpResponseError with a StatusCode of 401 or 403 often indicate the caller doesn't have sufficient permissions for the specified API. Check the [service documentation](https://learn.microsoft.com/azure/attestation/) to determine which RBAC roles are needed for the specific request, and ensure the authenticated user or service principal have been granted the appropriate roles on the resource.

## Next Steps

If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.

## Examples

Code samples for this package can be found at:
- [Search Attestation 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)


## Contributing
## Troubleshooting

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
## Next steps

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.
## Provide Feedback

This project has adopted the
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information, see the
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [[email protected]](mailto:[email protected]) with any
additional questions or comments.
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
10 changes: 5 additions & 5 deletions sdk/attestation/azure-mgmt-attestation/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e",
"commit": "4c6d0481729ff095999f4edf219bd68f9347d719",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.2.1",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.34.1",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/attestation/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.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/attestation/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/attestation/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +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 ._attestation_management_client import AttestationManagementClient
from typing import TYPE_CHECKING

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

from ._attestation_management_client import AttestationManagementClient # 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__ = [
"AttestationManagementClient",
]
__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()
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@
# --------------------------------------------------------------------------

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

from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.settings import settings
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from azure.mgmt.core.tools import get_arm_endpoints

from . import models
from . import models as _models
from ._configuration import AttestationManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import AttestationProvidersOperations, Operations, PrivateEndpointConnectionsOperations
from ._utils.serialization import Deserializer, Serializer
from .operations import (
AttestationProvidersOperations,
Operations,
PrivateEndpointConnectionsOperations,
PrivateLinkResourcesOperations,
)

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


class AttestationManagementClient: # pylint: disable=client-accepts-api-version-keyword
class AttestationManagementClient:
"""Various APIs for managing resources in attestation service. This primarily encompasses
per-provider management.
Expand All @@ -34,30 +43,53 @@ class AttestationManagementClient: # pylint: disable=client-accepts-api-version
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections:
azure.mgmt.attestation.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources:
azure.mgmt.attestation.operations.PrivateLinkResourcesOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
: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".
:param base_url: Service URL. Default value is None.
:type base_url: str
:keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this
:keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
) -> None:
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
_endpoints = get_arm_endpoints(_cloud)
if not base_url:
base_url = _endpoints["resource_manager"]
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
self._config = AttestationManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
_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),
ARMAutoResourceProviderRegistrationPolicy(),
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: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **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
Expand All @@ -68,8 +100,11 @@ def __init__(
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self._config, self._serialize, self._deserialize
)

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 @@ -89,17 +124,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
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: () -> AttestationManagementClient
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)
Loading