From 1db248d1c18876f5d476b8435083edf9b82b4122 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 15 Jan 2021 03:29:11 +0000 Subject: [PATCH] CodeGen from PR 12417 in Azure/azure-rest-api-specs [Hub Generated] Public private branch 'task/add_confidential-ledger_api_specs' (#12417) * Add Confidential Ledger API specs * fixing swagger validations * fixing model validation * fixing swagger model validation * fixing model validation * fixing model validation * adding examples * fixing readme.md * fixing readme references * fixing reference issue in readme * fixing file issue * file rename * fixing linter issues * minor changes * adding SystemData * adding systemData * minor changes * trying to fix model validation issue * Fixing Model Validation * fixing readme.md * fixing sdk generation * fixing readme.md and go files * minor changes * trying to fix go sdk * fixing url escaping * fixing go sdk generation * addressing comments to use common type definition * minor example fixes * updating python sdk output folder path * fixing output folder for python * fix python sdk output folder * updating the release name * minor changes * Revert "minor changes" This reverts commit 8ec2a9a805eade9308ad4ac22768280ebff3b0b6. * Revert "updating the release name" This reverts commit 3fbbec180e1c8cac67ba8342179aff9d05f78283. * updating python package version * updating api version * naming directory * fixing minor issue * add go multi-api support --- .../azure/mgmt/confidentialledger/__init__.py | 19 + .../_confidential_ledger.py | 55 ++ .../mgmt/confidentialledger/_configuration.py | 49 ++ .../confidentialledger/models/__init__.py | 64 +++ .../models/_confidential_ledger_enums.py | 38 ++ .../mgmt/confidentialledger/models/_models.py | 426 ++++++++++++++ .../confidentialledger/models/_models_py3.py | 426 ++++++++++++++ .../models/_paged_models.py | 40 ++ .../confidentialledger/operations/__init__.py | 18 + .../operations/_ledger_operations.py | 537 ++++++++++++++++++ .../operations/_operations.py | 104 ++++ .../azure/mgmt/confidentialledger/version.py | 13 + 12 files changed, 1789 insertions(+) create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/__init__.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_configuration.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/__init__.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_confidential_ledger_enums.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models_py3.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_paged_models.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/__init__.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_ledger_operations.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_operations.py create mode 100644 sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/version.py diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/__init__.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/__init__.py new file mode 100644 index 000000000000..d5dc95e4ca17 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/__init__.py @@ -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 ._configuration import ConfidentialLedgerConfiguration +from ._confidential_ledger import ConfidentialLedger +__all__ = ['ConfidentialLedger', 'ConfidentialLedgerConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py new file mode 100644 index 000000000000..9fe22dd7ab62 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py @@ -0,0 +1,55 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import ConfidentialLedgerConfiguration +from .operations import Operations +from .operations import LedgerOperations +from . import models + + +class ConfidentialLedger(SDKClient): + """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. + + :ivar config: Configuration for client. + :vartype config: ConfidentialLedgerConfiguration + + :ivar operations: Operations operations + :vartype operations: microsoft.confidentialledger.operations.Operations + :ivar ledger: Ledger operations + :vartype ledger: microsoft.confidentialledger.operations.LedgerOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ConfidentialLedgerConfiguration(credentials, subscription_id, base_url) + super(ConfidentialLedger, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2020-12-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.ledger = LedgerOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_configuration.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_configuration.py new file mode 100644 index 000000000000..2e5b5f3dd3da --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_configuration.py @@ -0,0 +1,49 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class ConfidentialLedgerConfiguration(AzureConfiguration): + """Configuration for ConfidentialLedger + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The Azure subscription ID. This is a + GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ConfidentialLedgerConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-confidentialledger/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/__init__.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/__init__.py new file mode 100644 index 000000000000..6722792c91d2 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/__init__.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ConfidentialLedgerCertUser + from ._models_py3 import ConfidentialLedgerModel + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import LedgerProperties + from ._models_py3 import Location + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperationDefinition + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import SystemData + from ._models_py3 import Tags +except (SyntaxError, ImportError): + from ._models import ConfidentialLedgerCertUser + from ._models import ConfidentialLedgerModel + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException + from ._models import LedgerProperties + from ._models import Location + from ._models import Resource + from ._models import ResourceProviderOperationDefinition + from ._models import ResourceProviderOperationDisplay + from ._models import SystemData + from ._models import Tags +from ._paged_models import ConfidentialLedgerModelPaged +from ._paged_models import ResourceProviderOperationDefinitionPaged +from ._confidential_ledger_enums import ( + CreatedByType, + LedgerType, + ProvisioningState, +) + +__all__ = [ + 'ConfidentialLedgerCertUser', + 'ConfidentialLedgerModel', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', + 'LedgerProperties', + 'Location', + 'Resource', + 'ResourceProviderOperationDefinition', + 'ResourceProviderOperationDisplay', + 'SystemData', + 'Tags', + 'ResourceProviderOperationDefinitionPaged', + 'ConfidentialLedgerModelPaged', + 'CreatedByType', + 'LedgerType', + 'ProvisioningState', +] diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_confidential_ledger_enums.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_confidential_ledger_enums.py new file mode 100644 index 000000000000..69259e4359c0 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_confidential_ledger_enums.py @@ -0,0 +1,38 @@ +# 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 enum import Enum + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" + + +class LedgerType(str, Enum): + + unknown = "Unknown" + public = "Public" + private = "Private" + + +class ProvisioningState(str, Enum): + + unknown = "Unknown" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + creating = "Creating" + deleting = "Deleting" + updating = "Updating" diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models.py new file mode 100644 index 000000000000..464fbfbc0cfd --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models.py @@ -0,0 +1,426 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConfidentialLedgerCertUser(Model): + """User cert and permissions associated with that user. + + :param cert: Base64 encoded public key of the user cert (.pem or .cer) + :type cert: str + """ + + _attribute_map = { + 'cert': {'key': 'cert', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConfidentialLedgerCertUser, self).__init__(**kwargs) + self.cert = kwargs.get('cert', None) + + +class ConfidentialLedgerModel(Model): + """Confidential Ledger. Contains the properties of Confidential Ledger + Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Resource. + :vartype name: str + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification + of the resource + :vartype system_data: ~microsoft.confidentialledger.models.SystemData + :param location: The Azure location where the Confidential Ledger is + running. + :type location: str + :param tags: Additional tags for Confidential Ledger + :type tags: dict[str, str] + :param properties: Properties of Confidential Ledger Resource. + :type properties: ~microsoft.confidentialledger.models.LedgerProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'LedgerProperties'}, + } + + def __init__(self, **kwargs): + super(ConfidentialLedgerModel, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft.confidentialledger.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~microsoft.confidentialledger.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~microsoft.confidentialledger.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LedgerProperties(Model): + """LedgerProperties. + + Additional Confidential Ledger properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar ledger_name: Unique name for the Confidential Ledger. + :vartype ledger_name: str + :ivar ledger_uri: Endpoint for calling Ledger Service. + :vartype ledger_uri: str + :ivar identity_service_uri: Endpoint for accessing network identity. + :vartype identity_service_uri: str + :ivar ledger_internal_namespace: Internal namespace for the Ledger + :vartype ledger_internal_namespace: str + :param ledger_storage_account: Name of the Blob Storage Account for saving + ledger files + :type ledger_storage_account: str + :param ledger_type: Type of Confidential Ledger. Possible values include: + 'Unknown', 'Public', 'Private' + :type ledger_type: str or ~microsoft.confidentialledger.models.LedgerType + :ivar provisioning_state: Provisioning state of Ledger Resource. Possible + values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Creating', + 'Deleting', 'Updating' + :vartype provisioning_state: str or + ~microsoft.confidentialledger.models.ProvisioningState + :param cert_users: Array of all the cert based users who can access + Confidential Ledger + :type cert_users: + list[~microsoft.confidentialledger.models.ConfidentialLedgerCertUser] + """ + + _validation = { + 'ledger_name': {'readonly': True}, + 'ledger_uri': {'readonly': True}, + 'identity_service_uri': {'readonly': True}, + 'ledger_internal_namespace': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'ledger_name': {'key': 'ledgerName', 'type': 'str'}, + 'ledger_uri': {'key': 'ledgerUri', 'type': 'str'}, + 'identity_service_uri': {'key': 'identityServiceUri', 'type': 'str'}, + 'ledger_internal_namespace': {'key': 'ledgerInternalNamespace', 'type': 'str'}, + 'ledger_storage_account': {'key': 'ledgerStorageAccount', 'type': 'str'}, + 'ledger_type': {'key': 'ledgerType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cert_users': {'key': 'certUsers', 'type': '[ConfidentialLedgerCertUser]'}, + } + + def __init__(self, **kwargs): + super(LedgerProperties, self).__init__(**kwargs) + self.ledger_name = None + self.ledger_uri = None + self.identity_service_uri = None + self.ledger_internal_namespace = None + self.ledger_storage_account = kwargs.get('ledger_storage_account', None) + self.ledger_type = kwargs.get('ledger_type', None) + self.provisioning_state = None + self.cert_users = kwargs.get('cert_users', None) + + +class Location(Model): + """Location of the ARM Resource. + + :param location: The Azure location where the Confidential Ledger is + running. + :type location: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Location, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + + +class Resource(Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Resource. + :vartype name: str + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification + of the resource + :vartype system_data: ~microsoft.confidentialledger.models.SystemData + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + + +class ResourceProviderOperationDefinition(Model): + """Describes the Resource Provider Operation. + + :param name: Resource provider operation name. + :type name: str + :param is_data_action: Indicates whether the operation is data action or + not. + :type is_data_action: bool + :param display: Details about the operations + :type display: + ~microsoft.confidentialledger.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, **kwargs): + super(ResourceProviderOperationDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + + +class ResourceProviderOperationDisplay(Model): + """Describes the properties of the Operation. + + :param provider: Name of the resource provider. + :type provider: str + :param resource: Name of the resource type. + :type resource: str + :param operation: Name of the resource provider operation. + :type operation: str + :param description: Description of the resource provider operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~microsoft.confidentialledger.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~microsoft.confidentialledger.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class Tags(Model): + """Tags for Confidential Ledger Resource. + + :param tags: Additional tags for Confidential Ledger + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Tags, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models_py3.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models_py3.py new file mode 100644 index 000000000000..6733d815077f --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_models_py3.py @@ -0,0 +1,426 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConfidentialLedgerCertUser(Model): + """User cert and permissions associated with that user. + + :param cert: Base64 encoded public key of the user cert (.pem or .cer) + :type cert: str + """ + + _attribute_map = { + 'cert': {'key': 'cert', 'type': 'str'}, + } + + def __init__(self, *, cert: str=None, **kwargs) -> None: + super(ConfidentialLedgerCertUser, self).__init__(**kwargs) + self.cert = cert + + +class ConfidentialLedgerModel(Model): + """Confidential Ledger. Contains the properties of Confidential Ledger + Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Resource. + :vartype name: str + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification + of the resource + :vartype system_data: ~microsoft.confidentialledger.models.SystemData + :param location: The Azure location where the Confidential Ledger is + running. + :type location: str + :param tags: Additional tags for Confidential Ledger + :type tags: dict[str, str] + :param properties: Properties of Confidential Ledger Resource. + :type properties: ~microsoft.confidentialledger.models.LedgerProperties + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'LedgerProperties'}, + } + + def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) -> None: + super(ConfidentialLedgerModel, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + self.location = location + self.tags = tags + self.properties = properties + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~microsoft.confidentialledger.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~microsoft.confidentialledger.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~microsoft.confidentialledger.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class LedgerProperties(Model): + """LedgerProperties. + + Additional Confidential Ledger properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar ledger_name: Unique name for the Confidential Ledger. + :vartype ledger_name: str + :ivar ledger_uri: Endpoint for calling Ledger Service. + :vartype ledger_uri: str + :ivar identity_service_uri: Endpoint for accessing network identity. + :vartype identity_service_uri: str + :ivar ledger_internal_namespace: Internal namespace for the Ledger + :vartype ledger_internal_namespace: str + :param ledger_storage_account: Name of the Blob Storage Account for saving + ledger files + :type ledger_storage_account: str + :param ledger_type: Type of Confidential Ledger. Possible values include: + 'Unknown', 'Public', 'Private' + :type ledger_type: str or ~microsoft.confidentialledger.models.LedgerType + :ivar provisioning_state: Provisioning state of Ledger Resource. Possible + values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Creating', + 'Deleting', 'Updating' + :vartype provisioning_state: str or + ~microsoft.confidentialledger.models.ProvisioningState + :param cert_users: Array of all the cert based users who can access + Confidential Ledger + :type cert_users: + list[~microsoft.confidentialledger.models.ConfidentialLedgerCertUser] + """ + + _validation = { + 'ledger_name': {'readonly': True}, + 'ledger_uri': {'readonly': True}, + 'identity_service_uri': {'readonly': True}, + 'ledger_internal_namespace': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'ledger_name': {'key': 'ledgerName', 'type': 'str'}, + 'ledger_uri': {'key': 'ledgerUri', 'type': 'str'}, + 'identity_service_uri': {'key': 'identityServiceUri', 'type': 'str'}, + 'ledger_internal_namespace': {'key': 'ledgerInternalNamespace', 'type': 'str'}, + 'ledger_storage_account': {'key': 'ledgerStorageAccount', 'type': 'str'}, + 'ledger_type': {'key': 'ledgerType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'cert_users': {'key': 'certUsers', 'type': '[ConfidentialLedgerCertUser]'}, + } + + def __init__(self, *, ledger_storage_account: str=None, ledger_type=None, cert_users=None, **kwargs) -> None: + super(LedgerProperties, self).__init__(**kwargs) + self.ledger_name = None + self.ledger_uri = None + self.identity_service_uri = None + self.ledger_internal_namespace = None + self.ledger_storage_account = ledger_storage_account + self.ledger_type = ledger_type + self.provisioning_state = None + self.cert_users = cert_users + + +class Location(Model): + """Location of the ARM Resource. + + :param location: The Azure location where the Confidential Ledger is + running. + :type location: str + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, **kwargs) -> None: + super(Location, self).__init__(**kwargs) + self.location = location + + +class Resource(Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the Resource. + :vartype name: str + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification + of the resource + :vartype system_data: ~microsoft.confidentialledger.models.SystemData + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.name = None + self.id = None + self.type = None + self.system_data = None + + +class ResourceProviderOperationDefinition(Model): + """Describes the Resource Provider Operation. + + :param name: Resource provider operation name. + :type name: str + :param is_data_action: Indicates whether the operation is data action or + not. + :type is_data_action: bool + :param display: Details about the operations + :type display: + ~microsoft.confidentialledger.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, **kwargs) -> None: + super(ResourceProviderOperationDefinition, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + + +class ResourceProviderOperationDisplay(Model): + """Describes the properties of the Operation. + + :param provider: Name of the resource provider. + :type provider: str + :param resource: Name of the resource type. + :type resource: str + :param operation: Name of the resource provider operation. + :type operation: str + :param description: Description of the resource provider operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~microsoft.confidentialledger.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~microsoft.confidentialledger.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Tags(Model): + """Tags for Confidential Ledger Resource. + + :param tags: Additional tags for Confidential Ledger + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(Tags, self).__init__(**kwargs) + self.tags = tags diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_paged_models.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_paged_models.py new file mode 100644 index 000000000000..fded1d013445 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/models/_paged_models.py @@ -0,0 +1,40 @@ +# 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 msrest.paging import Paged + + +class ResourceProviderOperationDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ResourceProviderOperationDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ResourceProviderOperationDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourceProviderOperationDefinitionPaged, self).__init__(*args, **kwargs) +class ConfidentialLedgerModelPaged(Paged): + """ + A paging container for iterating over a list of :class:`ConfidentialLedgerModel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ConfidentialLedgerModel]'} + } + + def __init__(self, *args, **kwargs): + + super(ConfidentialLedgerModelPaged, self).__init__(*args, **kwargs) diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/__init__.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/__init__.py new file mode 100644 index 000000000000..49109bc71793 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 ._operations import Operations +from ._ledger_operations import LedgerOperations + +__all__ = [ + 'Operations', + 'LedgerOperations', +] diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_ledger_operations.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_ledger_operations.py new file mode 100644 index 000000000000..b6f0b1a9e599 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_ledger_operations.py @@ -0,0 +1,537 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class LedgerOperations(object): + """LedgerOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-12-01-preview" + + self.config = config + + def get( + self, resource_group_name, ledger_name, custom_headers=None, raw=False, **operation_config): + """Retrieves information about a Confidential Ledger resource. + + Retrieves the properties of a Confidential Ledger. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ledger_name: Name of the Confidential Ledger + :type ledger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConfidentialLedgerModel or ClientRawResponse if raw=true + :rtype: ~microsoft.confidentialledger.models.ConfidentialLedgerModel + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=3), + 'ledgerName': self._serialize.url("ledger_name", ledger_name, 'str', pattern=r'^[a-zA-Z0-9]') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConfidentialLedgerModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}'} + + + def _delete_initial( + self, resource_group_name, ledger_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=3), + 'ledgerName': self._serialize.url("ledger_name", ledger_name, 'str', pattern=r'^[a-zA-Z0-9]') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, ledger_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a Confidential Ledger resource. + + Deletes an existing Confidential Ledger. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ledger_name: Name of the Confidential Ledger + :type ledger_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + ledger_name=ledger_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}'} + + + def _create_initial( + self, resource_group_name, ledger_name, confidential_ledger, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=3), + 'ledgerName': self._serialize.url("ledger_name", ledger_name, 'str', pattern=r'^[a-zA-Z0-9]') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(confidential_ledger, 'ConfidentialLedgerModel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConfidentialLedgerModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, ledger_name, confidential_ledger, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a Confidential Ledger. + + Creates a Confidential Ledger with the specified ledger parameters. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ledger_name: Name of the Confidential Ledger + :type ledger_name: str + :param confidential_ledger: Confidential Ledger Create Request Body + :type confidential_ledger: + ~microsoft.confidentialledger.models.ConfidentialLedgerModel + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ConfidentialLedgerModel + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~microsoft.confidentialledger.models.ConfidentialLedgerModel] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~microsoft.confidentialledger.models.ConfidentialLedgerModel]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + ledger_name=ledger_name, + confidential_ledger=confidential_ledger, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ConfidentialLedgerModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}'} + + + def _update_initial( + self, resource_group_name, ledger_name, confidential_ledger, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=3), + 'ledgerName': self._serialize.url("ledger_name", ledger_name, 'str', pattern=r'^[a-zA-Z0-9]') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(confidential_ledger, 'ConfidentialLedgerModel') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConfidentialLedgerModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, ledger_name, confidential_ledger, custom_headers=None, raw=False, polling=True, **operation_config): + """Update Confidential Ledger properties. + + Updates properties of Confidential Ledger. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ledger_name: Name of the Confidential Ledger + :type ledger_name: str + :param confidential_ledger: Confidential Ledger request body for + Updating Ledger + :type confidential_ledger: + ~microsoft.confidentialledger.models.ConfidentialLedgerModel + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ConfidentialLedgerModel + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~microsoft.confidentialledger.models.ConfidentialLedgerModel] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~microsoft.confidentialledger.models.ConfidentialLedgerModel]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + ledger_name=ledger_name, + confidential_ledger=confidential_ledger, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ConfidentialLedgerModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}'} + + def list_by_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves information about all Confidential Ledger resources under the + given subscription and resource group. + + Retrieves the properties of all Confidential Ledgers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the list operation. eg. + $filter=ledgerType eq 'Public' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ConfidentialLedgerModel + :rtype: + ~microsoft.confidentialledger.models.ConfidentialLedgerModelPaged[~microsoft.confidentialledger.models.ConfidentialLedgerModel] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=3) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConfidentialLedgerModelPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers'} + + def list_by_subscription( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves information about all Confidential Ledger resources under the + given subscription. + + Retrieves the properties of all Confidential Ledgers. + + :param filter: The filter to apply on the list operation. eg. + $filter=ledgerType eq 'Public' + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ConfidentialLedgerModel + :rtype: + ~microsoft.confidentialledger.models.ConfidentialLedgerModelPaged[~microsoft.confidentialledger.models.ConfidentialLedgerModel] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConfidentialLedgerModelPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers/'} diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_operations.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_operations.py new file mode 100644 index 000000000000..79a148c441be --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/operations/_operations.py @@ -0,0 +1,104 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to be used with the HTTP request. Constant value: "2020-12-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-12-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Retrieves a list of available API operations under this Resource + Provider. + + Retrieves a list of available API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ResourceProviderOperationDefinition + :rtype: + ~microsoft.confidentialledger.models.ResourceProviderOperationDefinitionPaged[~microsoft.confidentialledger.models.ResourceProviderOperationDefinition] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ResourceProviderOperationDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ConfidentialLedger/operations'} diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/version.py b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/version.py new file mode 100644 index 000000000000..b8ffb04f789f --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/version.py @@ -0,0 +1,13 @@ +# 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 = "0.0.1" +