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

Create Initial cut at an early preview (machine generated) version of python SDK. #15712

Merged
merged 45 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4eb3b81
Created MAA GA API surface
LarryOsterman Nov 30, 2020
b17c1f1
Added missing files
LarryOsterman Nov 30, 2020
4f48fd0
Updated
LarryOsterman Dec 1, 2020
076e9d9
Updated track 2 multiapi Python SDK
LarryOsterman Dec 1, 2020
c61d79b
Merge branch 'master' into LarryO-CreatePythonSDK
LarryOsterman Dec 4, 2020
d606a9e
First cut at Python SDK
LarryOsterman Dec 7, 2020
5f3037b
Created
LarryOsterman Dec 7, 2020
8f64582
Checkpoint
LarryOsterman Dec 7, 2020
9cfa214
Merge branch 'master' into LarryO-CreatePythonSDK
LarryOsterman Dec 7, 2020
176cc18
Checkpoint
LarryOsterman Dec 8, 2020
d926ea7
Checkpoint - get policy test works
LarryOsterman Dec 8, 2020
3d5604f
Updated with current changes
LarryOsterman Dec 8, 2020
bb02537
Renamed more fields
LarryOsterman Dec 8, 2020
4777457
Preview version of Python MAA SDK
LarryOsterman Dec 8, 2020
32cf926
Updated readme
LarryOsterman Dec 8, 2020
3098f6c
CI error fixes
LarryOsterman Dec 8, 2020
de77332
Windows Py38 fix
LarryOsterman Dec 8, 2020
59a2476
Missed one last interpolated string
LarryOsterman Dec 9, 2020
3c9298d
Use preparer decorator instead of original_env
LarryOsterman Dec 9, 2020
27b2b6e
Switched to use decorator throughout
LarryOsterman Dec 9, 2020
e3c2cb8
Import x509 module separately
LarryOsterman Dec 9, 2020
c63e81e
Merge branch 'master' into LarryO-CreatePythonSDK
LarryOsterman Dec 9, 2020
a221a01
Backed out mgmt changes accidentally included
LarryOsterman Dec 9, 2020
bd67ea5
Updated to match master
LarryOsterman Dec 9, 2020
9098d4d
Resynced mgmt to exactly match master
LarryOsterman Dec 9, 2020
ffc9699
Updated - cleaned up recordings directory; fixed several typos
LarryOsterman Dec 9, 2020
0bb2ab3
Moved service implementation around
LarryOsterman Dec 9, 2020
f7b7ab7
Updated setup.py to reflect new location of SDK
LarryOsterman Dec 9, 2020
d63e97d
Updates for CI pipeline
LarryOsterman Dec 9, 2020
7be8aee
mdlint update
LarryOsterman Dec 10, 2020
1df79e0
Added azuresecurityattestation to ci.yml
LarryOsterman Dec 10, 2020
1e8263b
Added back __init__.py files
LarryOsterman Dec 10, 2020
f30d6c9
Disable expiration time validation on JWTs
LarryOsterman Dec 10, 2020
a18285b
Updated version to 0.1.0-preview.
LarryOsterman Dec 10, 2020
0d2a772
Version == 1.0.0b1
LarryOsterman Dec 10, 2020
b395776
More 1.0.0b1 changes
LarryOsterman Dec 10, 2020
fbc7b49
Removed azure-security-nspkg for now
LarryOsterman Dec 10, 2020
9f0358c
Added azure-security-nspkg to dev requirements
LarryOsterman Dec 10, 2020
1f26627
Missed one expiration time check
LarryOsterman Dec 10, 2020
778c7df
Manifest and setup.py updates
LarryOsterman Dec 10, 2020
65ac132
Added override for dependant package versions
LarryOsterman Dec 10, 2020
c654688
Possibly unconfuse pylint
LarryOsterman Dec 10, 2020
5c36b65
add data plane library to allowed pylint failures
iscai-msft Dec 10, 2020
4ed1425
relative path to namespace package
iscai-msft Dec 10, 2020
c0cf4aa
add security nspkg to shared requirements
iscai-msft Dec 10, 2020
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
1 change: 1 addition & 0 deletions eng/tox/allowed_pylint_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@
"azure-synapse-managedprivateendpoints",
"azure-synapse-nspkg",
"azure-ai-anomalydetector",
"azure-security-attestation",
]
8 changes: 8 additions & 0 deletions sdk/attestation/azure-security-attestation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Release History

## 1.0.0b1 (2020-12-09)

Initial early preview release for MAA Data Plane SDK
Demonstrates use of the machine generated MAA APIs.

- Initial Release
5 changes: 5 additions & 0 deletions sdk/attestation/azure-security-attestation/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
include azure/security/__init__.py

49 changes: 49 additions & 0 deletions sdk/attestation/azure-security-attestation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Azure Attestation client library for Python

This is the Microsoft Azure Attestation Service Data Plane Client Library.
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).

# Getting started

For a rich example of a well formatted readme, please check [here.](https://github.com/Azure/azure-sdk/blob/master/docs/policies/README-TEMPLATE.md) In addition, this is an [example readme](https://github.com/Azure/azure-sdk/blob/master/docs/policies/README-EXAMPLE.md) that should be emulated. Note that the top-level sections in this template align with that of the [template.](https://github.com/Azure/azure-sdk/blob/master/docs/policies/README-TEMPLATE.md)

# Key concepts
This SDK provides the following functionality for the Microsoft Azure Attestation Service
* Microsoft Azure Attestation Enclave Attestation
* Attestation Policy Management APIs
* Attestation Policy Managemetn Certificate Management APIs.

# Examples

Examples of some of the key concepts for your library.

# Troubleshooting

Running into issues? This section should contain details as to what to do there.

# Next steps

More sample code should go here, along with links out to the appropriate example tests.

# Contributing

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.

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)


# Usage

For code examples, see [Azure Attestation DataPlane](https://docs.microsoft.com/python/api/overview/azure/)
on docs.microsoft.com.


# 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)
section of the project.


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-attestation%2FREADME.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._attestation_client import AttestationClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['AttestationClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

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

from azure.core.credentials import TokenCredential

from ._configuration import AttestationClientConfiguration
from .operations import PolicyOperations
from .operations import PolicyCertificatesOperations
from .operations import AttestationOperations
from .operations import SigningCertificatesOperations
from .operations import MetadataConfigurationOperations
from . import models


class AttestationClient(object):
"""Describes the interface for the per-tenant enclave service.

:ivar policy: PolicyOperations operations
:vartype policy: azure.security.attestation.operations.PolicyOperations
:ivar policy_certificates: PolicyCertificatesOperations operations
:vartype policy_certificates: azure.security.attestation.operations.PolicyCertificatesOperations
:ivar attestation: AttestationOperations operations
:vartype attestation: azure.security.attestation.operations.AttestationOperations
:ivar signing_certificates: SigningCertificatesOperations operations
:vartype signing_certificates: azure.security.attestation.operations.SigningCertificatesOperations
:ivar metadata_configuration: MetadataConfigurationOperations operations
:vartype metadata_configuration: azure.security.attestation.operations.MetadataConfigurationOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param instance_url: The attestation instance base URI, for example https://mytenant.attest.azure.net.
:type instance_url: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
instance_url, # type: str
**kwargs # type: Any
):
# type: (...) -> None
base_url = '{instanceUrl}'
self._config = AttestationClientConfiguration(credential, instance_url, **kwargs)
self._client = PipelineClient(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._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.policy = PolicyOperations(
self._client, self._config, self._serialize, self._deserialize)
self.policy_certificates = PolicyCertificatesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.attestation = AttestationOperations(
self._client, self._config, self._serialize, self._deserialize)
self.signing_certificates = SigningCertificatesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metadata_configuration = MetadataConfigurationOperations(
self._client, self._config, self._serialize, self._deserialize)

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

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

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

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

from ._version import VERSION

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

from azure.core.credentials import TokenCredential


class AttestationClientConfiguration(Configuration):
"""Configuration for AttestationClient.

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

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param instance_url: The attestation instance base URI, for example https://mytenant.attest.azure.net.
:type instance_url: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
instance_url, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if instance_url is None:
raise ValueError("Parameter 'instance_url' must not be None.")
super(AttestationClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.instance_url = instance_url
self.api_version = "2020-10-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://attest.azure.net/.default'])
kwargs.setdefault('sdk_moniker', 'security-attestation/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> 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.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._attestation_client import AttestationClient
__all__ = ['AttestationClient']
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, TYPE_CHECKING

from azure.core import AsyncPipelineClient
from msrest import Deserializer, Serializer

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

from ._configuration import AttestationClientConfiguration
from .operations import PolicyOperations
from .operations import PolicyCertificatesOperations
from .operations import AttestationOperations
from .operations import SigningCertificatesOperations
from .operations import MetadataConfigurationOperations
from .. import models


class AttestationClient(object):
"""Describes the interface for the per-tenant enclave service.

:ivar policy: PolicyOperations operations
:vartype policy: azure.security.attestation.aio.operations.PolicyOperations
:ivar policy_certificates: PolicyCertificatesOperations operations
:vartype policy_certificates: azure.security.attestation.aio.operations.PolicyCertificatesOperations
:ivar attestation: AttestationOperations operations
:vartype attestation: azure.security.attestation.aio.operations.AttestationOperations
:ivar signing_certificates: SigningCertificatesOperations operations
:vartype signing_certificates: azure.security.attestation.aio.operations.SigningCertificatesOperations
:ivar metadata_configuration: MetadataConfigurationOperations operations
:vartype metadata_configuration: azure.security.attestation.aio.operations.MetadataConfigurationOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param instance_url: The attestation instance base URI, for example https://mytenant.attest.azure.net.
:type instance_url: str
"""

def __init__(
self,
credential: "AsyncTokenCredential",
instance_url: str,
**kwargs: Any
) -> None:
base_url = '{instanceUrl}'
self._config = AttestationClientConfiguration(credential, instance_url, **kwargs)
self._client = AsyncPipelineClient(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._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.policy = PolicyOperations(
self._client, self._config, self._serialize, self._deserialize)
self.policy_certificates = PolicyCertificatesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.attestation = AttestationOperations(
self._client, self._config, self._serialize, self._deserialize)
self.signing_certificates = SigningCertificatesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metadata_configuration = MetadataConfigurationOperations(
self._client, self._config, self._serialize, self._deserialize)

async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "AttestationClient":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
Loading