Skip to content

Commit

Permalink
{Attestation} az attestation signer/policy: Bump API version from 2…
Browse files Browse the repository at this point in the history
…022-10-01 to 2022-08-01 (#7059)

* update

* update

* update

* update

* update

* update

* update

* update

* Update azext_metadata.json

* update

* update

* Update custom.py

* update

* update

* update

* update

* update

* Update src/attestation/azext_attestation/aaz/latest/__init__.py

* update

* update

---------

Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>
  • Loading branch information
ZengTaoxu and kairu-ms authored Dec 11, 2023
1 parent 762acaa commit 4a69523
Show file tree
Hide file tree
Showing 82 changed files with 6,892 additions and 6,327 deletions.
5 changes: 5 additions & 0 deletions src/attestation/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

1.0.0
++++++
* `az attestation `: Remove sdk
* `az attestation signer/ploicy`: Bump up api-version and remove sdk

0.2.1
++++++
* `az attestation policy show`: Fix encoding and decoding issues due to JWT upgrades
Expand Down
29 changes: 14 additions & 15 deletions src/attestation/azext_attestation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from azure.cli.core import AzCommandsLoader
try:
from azext_attestation.manual._help import helps # pylint: disable=reimported
from azext_attestation._help import helps # pylint: disable=reimported
except ImportError:
pass

Expand All @@ -19,31 +19,30 @@ class AttestationManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_attestation.generated._client_factory import cf_attestation_cl
attestation_custom = CliCommandType(
operations_tmpl='azext_attestation.custom#{}',
client_factory=cf_attestation_cl)
operations_tmpl='azext_attestation.custom#{}')
parent = super(AttestationManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=attestation_custom)

def load_command_table(self, args):
from azext_attestation.generated.commands import load_command_table
load_command_table(self, args)
from azext_attestation.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from azext_attestation.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
from . import aaz
except ImportError:
pass
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_attestation.generated._params import load_arguments
from azext_attestation._params import load_arguments
load_arguments(self, command)
try:
from azext_attestation.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = AttestationManagementClientCommandsLoader
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _):
pass
6 changes: 6 additions & 0 deletions src/attestation/azext_attestation/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# 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.
# 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.
# --------------------------------------------------------------------------
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

VERSION = "0.1.0"
# pylint: skip-file
# flake8: noqa

from ._clients import *
248 changes: 248 additions & 0 deletions src/attestation/azext_attestation/aaz/latest/_clients.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_client("AAZMicrosoftAttestationDataPlaneClient_attestation")
class AAZMicrosoftAttestationDataPlaneClient(AAZBaseClient):

_AAD_CREDENTIAL_SCOPES = [
"https://attest.azure.net/.default",
]

@classmethod
def _build_base_url(cls, ctx, **kwargs):
cls._fetch_endpoint(ctx, **kwargs)
host = ctx.selectors.endpoint.required().to_serialized_data()
if not isinstance(host, str):
raise ValueError(f"Invalid host value: '{host}'")
return host

@classmethod
def _build_configuration(cls, ctx, credential, **kwargs):
return AAZClientConfiguration(
credential=credential,
credential_scopes=cls._AAD_CREDENTIAL_SCOPES,
**kwargs
)

@classmethod
def _fetch_endpoint(cls, ctx, **kwargs):
cls.EndpointSelector(ctx=ctx, name="endpoint")
cls.AttestationProvidersGet(ctx=ctx)()

class EndpointSelector(AAZJsonSelector):

def _get(self):
result = self.ctx.vars.endpoint_instance
return result.properties.attestUri

def _set(self, value):
result = self.ctx.vars.endpoint_instance
result.properties.attestUri = value
return

class AttestationProvidersGet(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}",
**self.url_parameters
)

@property
def method(self):
return "GET"

@property
def error_format(self):
return "ODataV4Format"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"providerName", self.ctx.args.provider_name,
required=True,
),
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-06-01",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"endpoint_instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.location = AAZStrType(
flags={"required": True},
)
_schema_on_200.name = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.properties = AAZObjectType(
flags={"client_flatten": True},
)
_schema_on_200.system_data = AAZObjectType(
serialized_name="systemData",
flags={"read_only": True},
)
_schema_on_200.tags = AAZDictType()
_schema_on_200.type = AAZStrType(
flags={"read_only": True},
)

properties = cls._schema_on_200.properties
properties.attest_uri = AAZStrType(
serialized_name="attestUri",
)
properties.private_endpoint_connections = AAZListType(
serialized_name="privateEndpointConnections",
flags={"read_only": True},
)
properties.public_network_access = AAZStrType(
serialized_name="publicNetworkAccess",
)
properties.status = AAZStrType()
properties.tpm_attestation_authentication = AAZStrType(
serialized_name="tpmAttestationAuthentication",
)
properties.trust_model = AAZStrType(
serialized_name="trustModel",
)

private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections
private_endpoint_connections.Element = AAZObjectType()

_element = cls._schema_on_200.properties.private_endpoint_connections.Element
_element.id = AAZStrType(
flags={"read_only": True},
)
_element.name = AAZStrType(
flags={"read_only": True},
)
_element.properties = AAZObjectType(
flags={"client_flatten": True},
)
_element.type = AAZStrType(
flags={"read_only": True},
)

properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties
properties.private_endpoint = AAZObjectType(
serialized_name="privateEndpoint",
)
properties.private_link_service_connection_state = AAZObjectType(
serialized_name="privateLinkServiceConnectionState",
flags={"required": True},
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
)

private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint
private_endpoint.id = AAZStrType(
flags={"read_only": True},
)

private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state
private_link_service_connection_state.actions_required = AAZStrType(
serialized_name="actionsRequired",
)
private_link_service_connection_state.description = AAZStrType()
private_link_service_connection_state.status = AAZStrType()

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
)

tags = cls._schema_on_200.tags
tags.Element = AAZStrType()

return cls._schema_on_200


class _AAZMicrosoftAttestationDataPlaneClientHelper:
"""Helper class for AAZMicrosoftAttestationDataPlaneClient"""


__all__ = [
"AAZMicrosoftAttestationDataPlaneClient",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"attestation",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Microsoft Azure Attestation (MAA).
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._get_default_by_location import *
from ._list import *
from ._list_default import *
from ._show import *
from ._update import *
Loading

0 comments on commit 4a69523

Please sign in to comment.