From 16f08d0c19ae23667354826b0290bcc91f66494b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 7 Dec 2020 09:40:21 +0000 Subject: [PATCH] CodeGen from PR 11939 in Azure/azure-rest-api-specs [Hub Generated] Public private branch 'credscan-fix' (#11939) * Fix credscan * Fix more credentials --- .../azure/mgmt/blockchain/__init__.py | 19 + .../_blockchain_management_client.py | 76 ++ .../azure/mgmt/blockchain/_configuration.py | 50 ++ .../azure/mgmt/blockchain/models/__init__.py | 100 +++ .../_blockchain_management_client_enums.py | 46 ++ .../azure/mgmt/blockchain/models/_models.py | 707 +++++++++++++++++ .../mgmt/blockchain/models/_models_py3.py | 707 +++++++++++++++++ .../mgmt/blockchain/models/_paged_models.py | 66 ++ .../mgmt/blockchain/operations/__init__.py | 26 + ...ain_member_operation_results_operations.py | 101 +++ .../_blockchain_members_operations.py | 719 ++++++++++++++++++ .../operations/_locations_operations.py | 171 +++++ .../mgmt/blockchain/operations/_operations.py | 103 +++ .../blockchain/operations/_skus_operations.py | 95 +++ .../_transaction_nodes_operations.py | 607 +++++++++++++++ .../azure/mgmt/blockchain/version.py | 13 + 16 files changed, 3606 insertions(+) create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/__init__.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_blockchain_management_client.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_configuration.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/__init__.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_blockchain_management_client_enums.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models_py3.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_paged_models.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/__init__.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_member_operation_results_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_members_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_locations_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_skus_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_transaction_nodes_operations.py create mode 100644 sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/version.py diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/__init__.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/__init__.py new file mode 100644 index 000000000000..e127b511fc1d --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/__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 BlockchainManagementClientConfiguration +from ._blockchain_management_client import BlockchainManagementClient +__all__ = ['BlockchainManagementClient', 'BlockchainManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_blockchain_management_client.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_blockchain_management_client.py new file mode 100644 index 000000000000..2676cf7a6c50 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_blockchain_management_client.py @@ -0,0 +1,76 @@ +# 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 BlockchainManagementClientConfiguration +from .operations import BlockchainMembersOperations +from .operations import BlockchainMemberOperationResultsOperations +from .operations import LocationsOperations +from .operations import Operations +from .operations import SkusOperations +from .operations import TransactionNodesOperations +from . import models + + +class BlockchainManagementClient(SDKClient): + """REST API for Azure Blockchain Service + + :ivar config: Configuration for client. + :vartype config: BlockchainManagementClientConfiguration + + :ivar blockchain_members: BlockchainMembers operations + :vartype blockchain_members: azure.mgmt.blockchain.operations.BlockchainMembersOperations + :ivar blockchain_member_operation_results: BlockchainMemberOperationResults operations + :vartype blockchain_member_operation_results: azure.mgmt.blockchain.operations.BlockchainMemberOperationResultsOperations + :ivar locations: Locations operations + :vartype locations: azure.mgmt.blockchain.operations.LocationsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.blockchain.operations.Operations + :ivar skus: Skus operations + :vartype skus: azure.mgmt.blockchain.operations.SkusOperations + :ivar transaction_nodes: TransactionNodes operations + :vartype transaction_nodes: azure.mgmt.blockchain.operations.TransactionNodesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Gets the subscription Id which uniquely identifies + the Microsoft Azure subscription. The subscription ID is part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = BlockchainManagementClientConfiguration(credentials, subscription_id, base_url) + super(BlockchainManagementClient, 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 = '2018-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.blockchain_members = BlockchainMembersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.blockchain_member_operation_results = BlockchainMemberOperationResultsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transaction_nodes = TransactionNodesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_configuration.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_configuration.py new file mode 100644 index 000000000000..b0154dc09d4a --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/_configuration.py @@ -0,0 +1,50 @@ +# 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 BlockchainManagementClientConfiguration(AzureConfiguration): + """Configuration for BlockchainManagementClient + 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: Gets the subscription Id which uniquely identifies + the Microsoft Azure subscription. The subscription ID is part of the URI + for every service call. + :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(BlockchainManagementClientConfiguration, 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-blockchain/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/__init__.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/__init__.py new file mode 100644 index 000000000000..8344b54f8a37 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/__init__.py @@ -0,0 +1,100 @@ +# 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 ApiKey + from ._models_py3 import ApiKeyCollection + from ._models_py3 import BlockchainMember + from ._models_py3 import BlockchainMemberNodesSku + from ._models_py3 import BlockchainMemberUpdate + from ._models_py3 import Consortium + from ._models_py3 import ConsortiumCollection + from ._models_py3 import ConsortiumMember + from ._models_py3 import FirewallRule + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityRequest + from ._models_py3 import OperationResult + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceTypeSku + from ._models_py3 import ResourceTypeSkuCollection + from ._models_py3 import Sku + from ._models_py3 import SkuSetting + from ._models_py3 import TrackedResource + from ._models_py3 import TransactionNode + from ._models_py3 import TransactionNodeUpdate +except (SyntaxError, ImportError): + from ._models import ApiKey + from ._models import ApiKeyCollection + from ._models import BlockchainMember + from ._models import BlockchainMemberNodesSku + from ._models import BlockchainMemberUpdate + from ._models import Consortium + from ._models import ConsortiumCollection + from ._models import ConsortiumMember + from ._models import FirewallRule + from ._models import NameAvailability + from ._models import NameAvailabilityRequest + from ._models import OperationResult + from ._models import Resource + from ._models import ResourceProviderOperation + from ._models import ResourceProviderOperationDisplay + from ._models import ResourceTypeSku + from ._models import ResourceTypeSkuCollection + from ._models import Sku + from ._models import SkuSetting + from ._models import TrackedResource + from ._models import TransactionNode + from ._models import TransactionNodeUpdate +from ._paged_models import BlockchainMemberPaged +from ._paged_models import ConsortiumMemberPaged +from ._paged_models import ResourceProviderOperationPaged +from ._paged_models import TransactionNodePaged +from ._blockchain_management_client_enums import ( + BlockchainProtocol, + BlockchainMemberProvisioningState, + NameAvailabilityReason, + NodeProvisioningState, +) + +__all__ = [ + 'ApiKey', + 'ApiKeyCollection', + 'BlockchainMember', + 'BlockchainMemberNodesSku', + 'BlockchainMemberUpdate', + 'Consortium', + 'ConsortiumCollection', + 'ConsortiumMember', + 'FirewallRule', + 'NameAvailability', + 'NameAvailabilityRequest', + 'OperationResult', + 'Resource', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceTypeSku', + 'ResourceTypeSkuCollection', + 'Sku', + 'SkuSetting', + 'TrackedResource', + 'TransactionNode', + 'TransactionNodeUpdate', + 'BlockchainMemberPaged', + 'ConsortiumMemberPaged', + 'ResourceProviderOperationPaged', + 'TransactionNodePaged', + 'BlockchainProtocol', + 'BlockchainMemberProvisioningState', + 'NameAvailabilityReason', + 'NodeProvisioningState', +] diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_blockchain_management_client_enums.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_blockchain_management_client_enums.py new file mode 100644 index 000000000000..1af941724bcd --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_blockchain_management_client_enums.py @@ -0,0 +1,46 @@ +# 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 BlockchainProtocol(str, Enum): + + not_specified = "NotSpecified" + parity = "Parity" + quorum = "Quorum" + corda = "Corda" + + +class BlockchainMemberProvisioningState(str, Enum): + + not_specified = "NotSpecified" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" + stale = "Stale" + + +class NameAvailabilityReason(str, Enum): + + not_specified = "NotSpecified" + already_exists = "AlreadyExists" + invalid = "Invalid" + + +class NodeProvisioningState(str, Enum): + + not_specified = "NotSpecified" + updating = "Updating" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models.py new file mode 100644 index 000000000000..3a35dc07842e --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models.py @@ -0,0 +1,707 @@ +# 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 + + +class ApiKey(Model): + """API key payload which is exposed in the request/response of the resource + provider. + + :param key_name: Gets or sets the API key name. + :type key_name: str + :param value: Gets or sets the API key value. + :type value: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ApiKey, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + self.value = kwargs.get('value', None) + + +class ApiKeyCollection(Model): + """Collection of the API key payload which is exposed in the response of the + resource provider. + + :param keys: Gets or sets the collection of API key. + :type keys: list[~azure.mgmt.blockchain.models.ApiKey] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[ApiKey]'}, + } + + def __init__(self, **kwargs): + super(ApiKeyCollection, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + + +class Resource(Model): + """The core properties of the resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: The GEO location of the blockchain service. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class BlockchainMember(TrackedResource): + """Payload of the blockchain member which is exposed in the request/response + of the resource provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: The GEO location of the blockchain service. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + :param protocol: Gets or sets the blockchain protocol. Possible values + include: 'NotSpecified', 'Parity', 'Quorum', 'Corda' + :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + :param validator_nodes_sku: Gets or sets the blockchain validator nodes + Sku. + :type validator_nodes_sku: + ~azure.mgmt.blockchain.models.BlockchainMemberNodesSku + :ivar provisioning_state: Gets or sets the blockchain member provision + state. Possible values include: 'NotSpecified', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Stale' + :vartype provisioning_state: str or + ~azure.mgmt.blockchain.models.BlockchainMemberProvisioningState + :ivar dns: Gets the dns endpoint of the blockchain member. + :vartype dns: str + :ivar user_name: Gets the auth user name of the blockchain member. + :vartype user_name: str + :param password: Sets the basic auth password of the blockchain member. + :type password: str + :param consortium: Gets or sets the consortium for the blockchain member. + :type consortium: str + :ivar consortium_management_account_address: Gets the managed consortium + management account address. + :vartype consortium_management_account_address: str + :param consortium_management_account_password: Sets the managed consortium + management account password. + :type consortium_management_account_password: str + :param consortium_role: Gets the role of the member in the consortium. + :type consortium_role: str + :param consortium_member_display_name: Gets the display name of the member + in the consortium. + :type consortium_member_display_name: str + :ivar root_contract_address: Gets the Ethereum root contract address of + the blockchain. + :vartype root_contract_address: str + :ivar public_key: Gets the public key of the blockchain member (default + transaction node). + :vartype public_key: str + :param firewall_rules: Gets or sets firewall rules + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param sku: Gets or sets the blockchain member Sku. + :type sku: ~azure.mgmt.blockchain.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'dns': {'readonly': True}, + 'user_name': {'readonly': True}, + 'consortium_management_account_address': {'readonly': True}, + 'root_contract_address': {'readonly': True}, + 'public_key': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'validator_nodes_sku': {'key': 'properties.validatorNodesSku', 'type': 'BlockchainMemberNodesSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'dns': {'key': 'properties.dns', 'type': 'str'}, + 'user_name': {'key': 'properties.userName', 'type': 'str'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'consortium': {'key': 'properties.consortium', 'type': 'str'}, + 'consortium_management_account_address': {'key': 'properties.consortiumManagementAccountAddress', 'type': 'str'}, + 'consortium_management_account_password': {'key': 'properties.consortiumManagementAccountPassword', 'type': 'str'}, + 'consortium_role': {'key': 'properties.consortiumRole', 'type': 'str'}, + 'consortium_member_display_name': {'key': 'properties.consortiumMemberDisplayName', 'type': 'str'}, + 'root_contract_address': {'key': 'properties.rootContractAddress', 'type': 'str'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, **kwargs): + super(BlockchainMember, self).__init__(**kwargs) + self.protocol = kwargs.get('protocol', None) + self.validator_nodes_sku = kwargs.get('validator_nodes_sku', None) + self.provisioning_state = None + self.dns = None + self.user_name = None + self.password = kwargs.get('password', None) + self.consortium = kwargs.get('consortium', None) + self.consortium_management_account_address = None + self.consortium_management_account_password = kwargs.get('consortium_management_account_password', None) + self.consortium_role = kwargs.get('consortium_role', None) + self.consortium_member_display_name = kwargs.get('consortium_member_display_name', None) + self.root_contract_address = None + self.public_key = None + self.firewall_rules = kwargs.get('firewall_rules', None) + self.sku = kwargs.get('sku', None) + + +class BlockchainMemberNodesSku(Model): + """Payload of the blockchain member nodes Sku for a blockchain member. + + :param capacity: Gets or sets the nodes capacity. + :type capacity: int + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(BlockchainMemberNodesSku, self).__init__(**kwargs) + self.capacity = kwargs.get('capacity', None) + + +class BlockchainMemberUpdate(Model): + """Update the payload of the blockchain member which is exposed in the + request/response of the resource provider. + + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param consortium_management_account_password: Sets the managed consortium + management account password. + :type consortium_management_account_password: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + 'consortium_management_account_password': {'key': 'properties.consortiumManagementAccountPassword', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BlockchainMemberUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.password = kwargs.get('password', None) + self.firewall_rules = kwargs.get('firewall_rules', None) + self.consortium_management_account_password = kwargs.get('consortium_management_account_password', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Consortium(Model): + """Consortium payload. + + :param name: Gets or sets the blockchain member name. + :type name: str + :param protocol: Gets or sets the protocol for the consortium. Possible + values include: 'NotSpecified', 'Parity', 'Quorum', 'Corda' + :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Consortium, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.protocol = kwargs.get('protocol', None) + + +class ConsortiumCollection(Model): + """Collection of the consortium payload. + + :param value: Gets or sets the collection of consortiums. + :type value: list[~azure.mgmt.blockchain.models.Consortium] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Consortium]'}, + } + + def __init__(self, **kwargs): + super(ConsortiumCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ConsortiumMember(Model): + """Consortium approval. + + :param name: Gets the consortium member name. + :type name: str + :param display_name: Gets the consortium member display name. + :type display_name: str + :param subscription_id: Gets the consortium member subscription id. + :type subscription_id: str + :param role: Gets the consortium member role. + :type role: str + :param status: Gets the consortium member status. + :type status: str + :param join_date: Gets the consortium member join date. + :type join_date: datetime + :param date_modified: Gets the consortium member modified date. + :type date_modified: datetime + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'join_date': {'key': 'joinDate', 'type': 'iso-8601'}, + 'date_modified': {'key': 'dateModified', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ConsortiumMember, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.role = kwargs.get('role', None) + self.status = kwargs.get('status', None) + self.join_date = kwargs.get('join_date', None) + self.date_modified = kwargs.get('date_modified', None) + + +class FirewallRule(Model): + """Ip range for firewall rules. + + :param rule_name: Gets or sets the name of the firewall rules. + :type rule_name: str + :param start_ip_address: Gets or sets the start IP address of the firewall + rule range. + :type start_ip_address: str + :param end_ip_address: Gets or sets the end IP address of the firewall + rule range. + :type end_ip_address: str + """ + + _attribute_map = { + 'rule_name': {'key': 'ruleName', 'type': 'str'}, + 'start_ip_address': {'key': 'startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'endIpAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(FirewallRule, self).__init__(**kwargs) + self.rule_name = kwargs.get('rule_name', None) + self.start_ip_address = kwargs.get('start_ip_address', None) + self.end_ip_address = kwargs.get('end_ip_address', None) + + +class NameAvailability(Model): + """Name availability payload which is exposed in the response of the resource + provider. + + :param name_available: Gets or sets the value indicating whether the name + is available. + :type name_available: bool + :param message: Gets or sets the message. + :type message: str + :param reason: Gets or sets the name availability reason. Possible values + include: 'NotSpecified', 'AlreadyExists', 'Invalid' + :type reason: str or ~azure.mgmt.blockchain.models.NameAvailabilityReason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.message = kwargs.get('message', None) + self.reason = kwargs.get('reason', None) + + +class NameAvailabilityRequest(Model): + """Name availability request payload which is exposed in the request of the + resource provider. + + :param name: Gets or sets the name to check. + :type name: str + :param type: Gets or sets the type of the resource to check. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NameAvailabilityRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class OperationResult(Model): + """Operation result payload which is exposed in the response of the resource + provider. + + :param name: Gets or sets the operation name. + :type name: str + :param start_time: Gets or sets the operation start time. + :type start_time: datetime + :param end_time: Gets or sets the operation end time. + :type end_time: datetime + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(OperationResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + + +class ResourceProviderOperation(Model): + """Operation payload which is exposed in the response of the resource + provider. + + :param origin: Gets or sets the origin. + :type origin: str + :param name: Gets or sets the operation name. + :type name: str + :param is_data_action: Gets or sets a value indicating whether the + operation is a data action or not. + :type is_data_action: bool + :param display: Gets or sets operation display + :type display: + ~azure.mgmt.blockchain.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, **kwargs): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.origin = kwargs.get('origin', None) + 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): + """Operation display payload which is exposed in the response of the resource + provider. + + :param provider: Gets or sets the name of the provider for display + purposes. + :type provider: str + :param resource: Gets or sets the name of the resource type for display + purposes. + :type resource: str + :param operation: Gets or sets the name of the operation for display + purposes. + :type operation: str + :param description: Gets or sets the description of the provider for + display purposes. + :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 ResourceTypeSku(Model): + """Resource type Sku. + + :param resource_type: Gets or sets the resource type + :type resource_type: str + :param skus: Gets or sets the Skus + :type skus: list[~azure.mgmt.blockchain.models.SkuSetting] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[SkuSetting]'}, + } + + def __init__(self, **kwargs): + super(ResourceTypeSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.skus = kwargs.get('skus', None) + + +class ResourceTypeSkuCollection(Model): + """Collection of the resource type Sku. + + :param value: Gets or sets the collection of resource type Sku. + :type value: list[~azure.mgmt.blockchain.models.ResourceTypeSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, + } + + def __init__(self, **kwargs): + super(ResourceTypeSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Sku(Model): + """Blockchain member Sku in payload. + + :param name: Gets or sets Sku name + :type name: str + :param tier: Gets or sets Sku tier + :type tier: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + + +class SkuSetting(Model): + """Sku Setting. + + :param name: Gets or sets the Sku name. + :type name: str + :param tier: Gets or sets the Sku tier. + :type tier: str + :param locations: Gets or sets the locations. + :type locations: list[str] + :param required_features: Gets or sets the required features. + :type required_features: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(SkuSetting, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.locations = kwargs.get('locations', None) + self.required_features = kwargs.get('required_features', None) + + +class TransactionNode(Resource): + """Payload of the transaction node which is the request/response of the + resource provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: Gets or sets the transaction node location. + :type location: str + :ivar provisioning_state: Gets or sets the blockchain member provision + state. Possible values include: 'NotSpecified', 'Updating', 'Deleting', + 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.blockchain.models.NodeProvisioningState + :ivar dns: Gets or sets the transaction node dns endpoint. + :vartype dns: str + :ivar public_key: Gets or sets the transaction node public key. + :vartype public_key: str + :ivar user_name: Gets or sets the transaction node dns endpoint basic auth + user name. + :vartype user_name: str + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'dns': {'readonly': True}, + 'public_key': {'readonly': True}, + 'user_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'dns': {'key': 'properties.dns', 'type': 'str'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + 'user_name': {'key': 'properties.userName', 'type': 'str'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + } + + def __init__(self, **kwargs): + super(TransactionNode, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.provisioning_state = None + self.dns = None + self.public_key = None + self.user_name = None + self.password = kwargs.get('password', None) + self.firewall_rules = kwargs.get('firewall_rules', None) + + +class TransactionNodeUpdate(Model): + """Update the transaction node payload which is exposed in the + request/response of the resource provider. + + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + """ + + _attribute_map = { + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + } + + def __init__(self, **kwargs): + super(TransactionNodeUpdate, self).__init__(**kwargs) + self.password = kwargs.get('password', None) + self.firewall_rules = kwargs.get('firewall_rules', None) diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models_py3.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models_py3.py new file mode 100644 index 000000000000..3001cad9b343 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_models_py3.py @@ -0,0 +1,707 @@ +# 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 + + +class ApiKey(Model): + """API key payload which is exposed in the request/response of the resource + provider. + + :param key_name: Gets or sets the API key name. + :type key_name: str + :param value: Gets or sets the API key value. + :type value: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, key_name: str=None, value: str=None, **kwargs) -> None: + super(ApiKey, self).__init__(**kwargs) + self.key_name = key_name + self.value = value + + +class ApiKeyCollection(Model): + """Collection of the API key payload which is exposed in the response of the + resource provider. + + :param keys: Gets or sets the collection of API key. + :type keys: list[~azure.mgmt.blockchain.models.ApiKey] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[ApiKey]'}, + } + + def __init__(self, *, keys=None, **kwargs) -> None: + super(ApiKeyCollection, self).__init__(**kwargs) + self.keys = keys + + +class Resource(Model): + """The core properties of the resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: The GEO location of the blockchain service. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class BlockchainMember(TrackedResource): + """Payload of the blockchain member which is exposed in the request/response + of the resource provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: The GEO location of the blockchain service. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + :param protocol: Gets or sets the blockchain protocol. Possible values + include: 'NotSpecified', 'Parity', 'Quorum', 'Corda' + :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + :param validator_nodes_sku: Gets or sets the blockchain validator nodes + Sku. + :type validator_nodes_sku: + ~azure.mgmt.blockchain.models.BlockchainMemberNodesSku + :ivar provisioning_state: Gets or sets the blockchain member provision + state. Possible values include: 'NotSpecified', 'Updating', 'Deleting', + 'Succeeded', 'Failed', 'Stale' + :vartype provisioning_state: str or + ~azure.mgmt.blockchain.models.BlockchainMemberProvisioningState + :ivar dns: Gets the dns endpoint of the blockchain member. + :vartype dns: str + :ivar user_name: Gets the auth user name of the blockchain member. + :vartype user_name: str + :param password: Sets the basic auth password of the blockchain member. + :type password: str + :param consortium: Gets or sets the consortium for the blockchain member. + :type consortium: str + :ivar consortium_management_account_address: Gets the managed consortium + management account address. + :vartype consortium_management_account_address: str + :param consortium_management_account_password: Sets the managed consortium + management account password. + :type consortium_management_account_password: str + :param consortium_role: Gets the role of the member in the consortium. + :type consortium_role: str + :param consortium_member_display_name: Gets the display name of the member + in the consortium. + :type consortium_member_display_name: str + :ivar root_contract_address: Gets the Ethereum root contract address of + the blockchain. + :vartype root_contract_address: str + :ivar public_key: Gets the public key of the blockchain member (default + transaction node). + :vartype public_key: str + :param firewall_rules: Gets or sets firewall rules + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param sku: Gets or sets the blockchain member Sku. + :type sku: ~azure.mgmt.blockchain.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'dns': {'readonly': True}, + 'user_name': {'readonly': True}, + 'consortium_management_account_address': {'readonly': True}, + 'root_contract_address': {'readonly': True}, + 'public_key': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'protocol': {'key': 'properties.protocol', 'type': 'str'}, + 'validator_nodes_sku': {'key': 'properties.validatorNodesSku', 'type': 'BlockchainMemberNodesSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'dns': {'key': 'properties.dns', 'type': 'str'}, + 'user_name': {'key': 'properties.userName', 'type': 'str'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'consortium': {'key': 'properties.consortium', 'type': 'str'}, + 'consortium_management_account_address': {'key': 'properties.consortiumManagementAccountAddress', 'type': 'str'}, + 'consortium_management_account_password': {'key': 'properties.consortiumManagementAccountPassword', 'type': 'str'}, + 'consortium_role': {'key': 'properties.consortiumRole', 'type': 'str'}, + 'consortium_member_display_name': {'key': 'properties.consortiumMemberDisplayName', 'type': 'str'}, + 'root_contract_address': {'key': 'properties.rootContractAddress', 'type': 'str'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, *, location: str=None, tags=None, protocol=None, validator_nodes_sku=None, password: str=None, consortium: str=None, consortium_management_account_password: str=None, consortium_role: str=None, consortium_member_display_name: str=None, firewall_rules=None, sku=None, **kwargs) -> None: + super(BlockchainMember, self).__init__(location=location, tags=tags, **kwargs) + self.protocol = protocol + self.validator_nodes_sku = validator_nodes_sku + self.provisioning_state = None + self.dns = None + self.user_name = None + self.password = password + self.consortium = consortium + self.consortium_management_account_address = None + self.consortium_management_account_password = consortium_management_account_password + self.consortium_role = consortium_role + self.consortium_member_display_name = consortium_member_display_name + self.root_contract_address = None + self.public_key = None + self.firewall_rules = firewall_rules + self.sku = sku + + +class BlockchainMemberNodesSku(Model): + """Payload of the blockchain member nodes Sku for a blockchain member. + + :param capacity: Gets or sets the nodes capacity. + :type capacity: int + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, *, capacity: int=None, **kwargs) -> None: + super(BlockchainMemberNodesSku, self).__init__(**kwargs) + self.capacity = capacity + + +class BlockchainMemberUpdate(Model): + """Update the payload of the blockchain member which is exposed in the + request/response of the resource provider. + + :param tags: Tags of the service which is a list of key value pairs that + describes the resource. + :type tags: dict[str, str] + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param consortium_management_account_password: Sets the managed consortium + management account password. + :type consortium_management_account_password: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + 'consortium_management_account_password': {'key': 'properties.consortiumManagementAccountPassword', 'type': 'str'}, + } + + def __init__(self, *, tags=None, password: str=None, firewall_rules=None, consortium_management_account_password: str=None, **kwargs) -> None: + super(BlockchainMemberUpdate, self).__init__(**kwargs) + self.tags = tags + self.password = password + self.firewall_rules = firewall_rules + self.consortium_management_account_password = consortium_management_account_password + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Consortium(Model): + """Consortium payload. + + :param name: Gets or sets the blockchain member name. + :type name: str + :param protocol: Gets or sets the protocol for the consortium. Possible + values include: 'NotSpecified', 'Parity', 'Quorum', 'Corda' + :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, protocol=None, **kwargs) -> None: + super(Consortium, self).__init__(**kwargs) + self.name = name + self.protocol = protocol + + +class ConsortiumCollection(Model): + """Collection of the consortium payload. + + :param value: Gets or sets the collection of consortiums. + :type value: list[~azure.mgmt.blockchain.models.Consortium] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Consortium]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ConsortiumCollection, self).__init__(**kwargs) + self.value = value + + +class ConsortiumMember(Model): + """Consortium approval. + + :param name: Gets the consortium member name. + :type name: str + :param display_name: Gets the consortium member display name. + :type display_name: str + :param subscription_id: Gets the consortium member subscription id. + :type subscription_id: str + :param role: Gets the consortium member role. + :type role: str + :param status: Gets the consortium member status. + :type status: str + :param join_date: Gets the consortium member join date. + :type join_date: datetime + :param date_modified: Gets the consortium member modified date. + :type date_modified: datetime + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'join_date': {'key': 'joinDate', 'type': 'iso-8601'}, + 'date_modified': {'key': 'dateModified', 'type': 'iso-8601'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, subscription_id: str=None, role: str=None, status: str=None, join_date=None, date_modified=None, **kwargs) -> None: + super(ConsortiumMember, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.subscription_id = subscription_id + self.role = role + self.status = status + self.join_date = join_date + self.date_modified = date_modified + + +class FirewallRule(Model): + """Ip range for firewall rules. + + :param rule_name: Gets or sets the name of the firewall rules. + :type rule_name: str + :param start_ip_address: Gets or sets the start IP address of the firewall + rule range. + :type start_ip_address: str + :param end_ip_address: Gets or sets the end IP address of the firewall + rule range. + :type end_ip_address: str + """ + + _attribute_map = { + 'rule_name': {'key': 'ruleName', 'type': 'str'}, + 'start_ip_address': {'key': 'startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'endIpAddress', 'type': 'str'}, + } + + def __init__(self, *, rule_name: str=None, start_ip_address: str=None, end_ip_address: str=None, **kwargs) -> None: + super(FirewallRule, self).__init__(**kwargs) + self.rule_name = rule_name + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address + + +class NameAvailability(Model): + """Name availability payload which is exposed in the response of the resource + provider. + + :param name_available: Gets or sets the value indicating whether the name + is available. + :type name_available: bool + :param message: Gets or sets the message. + :type message: str + :param reason: Gets or sets the name availability reason. Possible values + include: 'NotSpecified', 'AlreadyExists', 'Invalid' + :type reason: str or ~azure.mgmt.blockchain.models.NameAvailabilityReason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__(self, *, name_available: bool=None, message: str=None, reason=None, **kwargs) -> None: + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.message = message + self.reason = reason + + +class NameAvailabilityRequest(Model): + """Name availability request payload which is exposed in the request of the + resource provider. + + :param name: Gets or sets the name to check. + :type name: str + :param type: Gets or sets the type of the resource to check. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(NameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class OperationResult(Model): + """Operation result payload which is exposed in the response of the resource + provider. + + :param name: Gets or sets the operation name. + :type name: str + :param start_time: Gets or sets the operation start time. + :type start_time: datetime + :param end_time: Gets or sets the operation end time. + :type end_time: datetime + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, name: str=None, start_time=None, end_time=None, **kwargs) -> None: + super(OperationResult, self).__init__(**kwargs) + self.name = name + self.start_time = start_time + self.end_time = end_time + + +class ResourceProviderOperation(Model): + """Operation payload which is exposed in the response of the resource + provider. + + :param origin: Gets or sets the origin. + :type origin: str + :param name: Gets or sets the operation name. + :type name: str + :param is_data_action: Gets or sets a value indicating whether the + operation is a data action or not. + :type is_data_action: bool + :param display: Gets or sets operation display + :type display: + ~azure.mgmt.blockchain.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__(self, *, origin: str=None, name: str=None, is_data_action: bool=None, display=None, **kwargs) -> None: + super(ResourceProviderOperation, self).__init__(**kwargs) + self.origin = origin + self.name = name + self.is_data_action = is_data_action + self.display = display + + +class ResourceProviderOperationDisplay(Model): + """Operation display payload which is exposed in the response of the resource + provider. + + :param provider: Gets or sets the name of the provider for display + purposes. + :type provider: str + :param resource: Gets or sets the name of the resource type for display + purposes. + :type resource: str + :param operation: Gets or sets the name of the operation for display + purposes. + :type operation: str + :param description: Gets or sets the description of the provider for + display purposes. + :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 ResourceTypeSku(Model): + """Resource type Sku. + + :param resource_type: Gets or sets the resource type + :type resource_type: str + :param skus: Gets or sets the Skus + :type skus: list[~azure.mgmt.blockchain.models.SkuSetting] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[SkuSetting]'}, + } + + def __init__(self, *, resource_type: str=None, skus=None, **kwargs) -> None: + super(ResourceTypeSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.skus = skus + + +class ResourceTypeSkuCollection(Model): + """Collection of the resource type Sku. + + :param value: Gets or sets the collection of resource type Sku. + :type value: list[~azure.mgmt.blockchain.models.ResourceTypeSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceTypeSku]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ResourceTypeSkuCollection, self).__init__(**kwargs) + self.value = value + + +class Sku(Model): + """Blockchain member Sku in payload. + + :param name: Gets or sets Sku name + :type name: str + :param tier: Gets or sets Sku tier + :type tier: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, tier: str=None, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + + +class SkuSetting(Model): + """Sku Setting. + + :param name: Gets or sets the Sku name. + :type name: str + :param tier: Gets or sets the Sku tier. + :type tier: str + :param locations: Gets or sets the locations. + :type locations: list[str] + :param required_features: Gets or sets the required features. + :type required_features: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'required_features': {'key': 'requiredFeatures', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, tier: str=None, locations=None, required_features=None, **kwargs) -> None: + super(SkuSetting, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.locations = locations + self.required_features = required_features + + +class TransactionNode(Resource): + """Payload of the transaction node which is the request/response of the + resource provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the service - e.g. "Microsoft.Blockchain" + :vartype type: str + :param location: Gets or sets the transaction node location. + :type location: str + :ivar provisioning_state: Gets or sets the blockchain member provision + state. Possible values include: 'NotSpecified', 'Updating', 'Deleting', + 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.blockchain.models.NodeProvisioningState + :ivar dns: Gets or sets the transaction node dns endpoint. + :vartype dns: str + :ivar public_key: Gets or sets the transaction node public key. + :vartype public_key: str + :ivar user_name: Gets or sets the transaction node dns endpoint basic auth + user name. + :vartype user_name: str + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'dns': {'readonly': True}, + 'public_key': {'readonly': True}, + 'user_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'dns': {'key': 'properties.dns', 'type': 'str'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + 'user_name': {'key': 'properties.userName', 'type': 'str'}, + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + } + + def __init__(self, *, location: str=None, password: str=None, firewall_rules=None, **kwargs) -> None: + super(TransactionNode, self).__init__(**kwargs) + self.location = location + self.provisioning_state = None + self.dns = None + self.public_key = None + self.user_name = None + self.password = password + self.firewall_rules = firewall_rules + + +class TransactionNodeUpdate(Model): + """Update the transaction node payload which is exposed in the + request/response of the resource provider. + + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + """ + + _attribute_map = { + 'password': {'key': 'properties.password', 'type': 'str'}, + 'firewall_rules': {'key': 'properties.firewallRules', 'type': '[FirewallRule]'}, + } + + def __init__(self, *, password: str=None, firewall_rules=None, **kwargs) -> None: + super(TransactionNodeUpdate, self).__init__(**kwargs) + self.password = password + self.firewall_rules = firewall_rules diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_paged_models.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_paged_models.py new file mode 100644 index 000000000000..ed6ed7c005eb --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/models/_paged_models.py @@ -0,0 +1,66 @@ +# 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 BlockchainMemberPaged(Paged): + """ + A paging container for iterating over a list of :class:`BlockchainMember ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BlockchainMember]'} + } + + def __init__(self, *args, **kwargs): + + super(BlockchainMemberPaged, self).__init__(*args, **kwargs) +class ConsortiumMemberPaged(Paged): + """ + A paging container for iterating over a list of :class:`ConsortiumMember ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ConsortiumMember]'} + } + + def __init__(self, *args, **kwargs): + + super(ConsortiumMemberPaged, self).__init__(*args, **kwargs) +class ResourceProviderOperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`ResourceProviderOperation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ResourceProviderOperation]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourceProviderOperationPaged, self).__init__(*args, **kwargs) +class TransactionNodePaged(Paged): + """ + A paging container for iterating over a list of :class:`TransactionNode ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TransactionNode]'} + } + + def __init__(self, *args, **kwargs): + + super(TransactionNodePaged, self).__init__(*args, **kwargs) diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/__init__.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/__init__.py new file mode 100644 index 000000000000..2a913ecdf5c8 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/__init__.py @@ -0,0 +1,26 @@ +# 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 ._blockchain_members_operations import BlockchainMembersOperations +from ._blockchain_member_operation_results_operations import BlockchainMemberOperationResultsOperations +from ._locations_operations import LocationsOperations +from ._operations import Operations +from ._skus_operations import SkusOperations +from ._transaction_nodes_operations import TransactionNodesOperations + +__all__ = [ + 'BlockchainMembersOperations', + 'BlockchainMemberOperationResultsOperations', + 'LocationsOperations', + 'Operations', + 'SkusOperations', + 'TransactionNodesOperations', +] diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_member_operation_results_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_member_operation_results_operations.py new file mode 100644 index 000000000000..0b1f4e34aad3 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_member_operation_results_operations.py @@ -0,0 +1,101 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class BlockchainMemberOperationResultsOperations(object): + """BlockchainMemberOperationResultsOperations 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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, location_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Get Async operation result. + + :param location_name: Location name. + :type location_name: str + :param operation_id: Operation Id. + :type operation_id: 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: OperationResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.OperationResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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') + + # 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, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/blockchainMemberOperationResults/{operationId}'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_members_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_members_operations.py new file mode 100644 index 000000000000..a1d2ca55a2fe --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_blockchain_members_operations.py @@ -0,0 +1,719 @@ +# 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 msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class BlockchainMembersOperations(object): + """BlockchainMembersOperations 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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get details about a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: BlockchainMember or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.BlockchainMember or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BlockchainMember', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + + + def _create_initial( + self, blockchain_member_name, resource_group_name, blockchain_member=None, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMember') + else: + body_content = None + + # 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, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BlockchainMember', response) + if response.status_code == 201: + deserialized = self._deserialize('BlockchainMember', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, blockchain_member_name, resource_group_name, blockchain_member=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param blockchain_member: Payload to create a blockchain member. + :type blockchain_member: + ~azure.mgmt.blockchain.models.BlockchainMember + :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 BlockchainMember or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.blockchain.models.BlockchainMember] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.blockchain.models.BlockchainMember]] + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + blockchain_member=blockchain_member, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BlockchainMember', 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.Blockchain/blockchainMembers/{blockchainMemberName}'} + + + def _delete_initial( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete a blockchain member. + + :param blockchain_member_name: Blockchain member name + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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:`CloudError` + """ + raw_result = self._delete_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_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.Blockchain/blockchainMembers/{blockchainMemberName}'} + + def update( + self, blockchain_member_name, resource_group_name, blockchain_member=None, custom_headers=None, raw=False, **operation_config): + """Update a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param blockchain_member: Payload to update the blockchain member. + :type blockchain_member: + ~azure.mgmt.blockchain.models.BlockchainMemberUpdate + :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: BlockchainMember or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.BlockchainMember or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMemberUpdate') + else: + body_content = None + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('BlockchainMember', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + + def list( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the blockchain members for a resource group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: An iterator like instance of BlockchainMember + :rtype: + ~azure.mgmt.blockchain.models.BlockchainMemberPaged[~azure.mgmt.blockchain.models.BlockchainMember] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.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') + } + 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') + + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.BlockchainMemberPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'} + + def list_all( + self, custom_headers=None, raw=False, **operation_config): + """Lists the blockchain members for a subscription. + + :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 BlockchainMember + :rtype: + ~azure.mgmt.blockchain.models.BlockchainMemberPaged[~azure.mgmt.blockchain.models.BlockchainMember] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_all.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') + + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.BlockchainMemberPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'} + + def list_consortium_members( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the consortium members for a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: An iterator like instance of ConsortiumMember + :rtype: + ~azure.mgmt.blockchain.models.ConsortiumMemberPaged[~azure.mgmt.blockchain.models.ConsortiumMember] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_consortium_members.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConsortiumMemberPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_consortium_members.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'} + + def list_api_keys( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the API keys for a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: ApiKeyCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_api_keys.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApiKeyCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'} + + def list_regenerate_api_keys( + self, blockchain_member_name, resource_group_name, key_name=None, value=None, custom_headers=None, raw=False, **operation_config): + """Regenerate the API keys for a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param key_name: Gets or sets the API key name. + :type key_name: str + :param value: Gets or sets the API key value. + :type value: 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: ApiKeyCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + api_key = None + if key_name is not None or value is not None: + api_key = models.ApiKey(key_name=key_name, value=value) + + # Construct URL + url = self.list_regenerate_api_keys.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApiKeyCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_locations_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_locations_operations.py new file mode 100644 index 000000000000..55a84cac81bf --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_locations_operations.py @@ -0,0 +1,171 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class LocationsOperations(object): + """LocationsOperations 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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def check_name_availability( + self, location_name, name=None, type=None, custom_headers=None, raw=False, **operation_config): + """To check whether a resource name is available. + + :param location_name: Location Name. + :type location_name: str + :param name: Gets or sets the name to check. + :type name: str + :param type: Gets or sets the type of the resource to check. + :type type: 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: NameAvailability or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.NameAvailability or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + name_availability_request = None + if name is not None or type is not None: + name_availability_request = models.NameAvailabilityRequest(name=name, type=type) + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + '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') + + # 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 + if name_availability_request is not None: + body_content = self._serialize.body(name_availability_request, 'NameAvailabilityRequest') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NameAvailability', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/checkNameAvailability'} + + def list_consortiums( + self, location_name, custom_headers=None, raw=False, **operation_config): + """Lists the available consortiums for a subscription. + + :param location_name: Location Name. + :type location_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: ConsortiumCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ConsortiumCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_consortiums.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + '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') + + # 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConsortiumCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_consortiums.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_operations.py new file mode 100644 index 000000000000..8323ea208e8a --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_operations.py @@ -0,0 +1,103 @@ +# 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 msrestazure.azure_exceptions import CloudError + +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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the available operations of Microsoft.Blockchain resource + provider. + + :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 ResourceProviderOperation + :rtype: + ~azure.mgmt.blockchain.models.ResourceProviderOperationPaged[~azure.mgmt.blockchain.models.ResourceProviderOperation] + :raises: :class:`CloudError` + """ + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ResourceProviderOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Blockchain/operations'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_skus_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_skus_operations.py new file mode 100644 index 000000000000..b8ae3d48c356 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_skus_operations.py @@ -0,0 +1,95 @@ +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class SkusOperations(object): + """SkusOperations 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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the Skus of the resource type. + + :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: ResourceTypeSkuCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ResourceTypeSkuCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.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') + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceTypeSkuCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_transaction_nodes_operations.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_transaction_nodes_operations.py new file mode 100644 index 000000000000..91c5386ab3bd --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/operations/_transaction_nodes_operations.py @@ -0,0 +1,607 @@ +# 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 msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class TransactionNodesOperations(object): + """TransactionNodesOperations 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: Client API Version. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, blockchain_member_name, transaction_node_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get the details of the transaction node. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: TransactionNode or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.TransactionNode or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TransactionNode', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + + + def _create_initial( + self, blockchain_member_name, transaction_node_name, resource_group_name, transaction_node=None, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNode') + else: + body_content = None + + # 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, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TransactionNode', response) + if response.status_code == 201: + deserialized = self._deserialize('TransactionNode', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, blockchain_member_name, transaction_node_name, resource_group_name, transaction_node=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update the transaction node. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param transaction_node: Payload to create the transaction node. + :type transaction_node: ~azure.mgmt.blockchain.models.TransactionNode + :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 TransactionNode or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.blockchain.models.TransactionNode] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.blockchain.models.TransactionNode]] + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_name, + transaction_node=transaction_node, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('TransactionNode', 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.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + + + def _delete_initial( + self, blockchain_member_name, transaction_node_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, blockchain_member_name, transaction_node_name, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete the transaction node. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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:`CloudError` + """ + raw_result = self._delete_initial( + blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_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.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + + def update( + self, blockchain_member_name, transaction_node_name, resource_group_name, password=None, firewall_rules=None, custom_headers=None, raw=False, **operation_config): + """Update the transaction node. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param password: Sets the transaction node dns endpoint basic auth + password. + :type password: str + :param firewall_rules: Gets or sets the firewall rules. + :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :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: TransactionNode or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.TransactionNode or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + transaction_node = None + if password is not None or firewall_rules is not None: + transaction_node = models.TransactionNodeUpdate(password=password, firewall_rules=firewall_rules) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNodeUpdate') + else: + body_content = None + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TransactionNode', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + + def list( + self, blockchain_member_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists the transaction nodes for a blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: An iterator like instance of TransactionNode + :rtype: + ~azure.mgmt.blockchain.models.TransactionNodePaged[~azure.mgmt.blockchain.models.TransactionNode] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TransactionNodePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'} + + def list_api_keys( + self, blockchain_member_name, transaction_node_name, resource_group_name, custom_headers=None, raw=False, **operation_config): + """List the API keys for the transaction node. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_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: ApiKeyCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_api_keys.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApiKeyCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'} + + def list_regenerate_api_keys( + self, blockchain_member_name, transaction_node_name, resource_group_name, key_name=None, value=None, custom_headers=None, raw=False, **operation_config): + """Regenerate the API keys for the blockchain member. + + :param blockchain_member_name: Blockchain member name. + :type blockchain_member_name: str + :param transaction_node_name: Transaction node name. + :type transaction_node_name: str + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param key_name: Gets or sets the API key name. + :type key_name: str + :param value: Gets or sets the API key value. + :type value: 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: ApiKeyCollection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + api_key = None + if key_name is not None or value is not None: + api_key = models.ApiKey(key_name=key_name, value=value) + + # Construct URL + url = self.list_regenerate_api_keys.metadata['url'] + path_format_arguments = { + 'blockchainMemberName': self._serialize.url("blockchain_member_name", blockchain_member_name, 'str'), + 'transactionNodeName': self._serialize.url("transaction_node_name", transaction_node_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + # 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 + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ApiKeyCollection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'} diff --git a/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/version.py b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/version.py new file mode 100644 index 000000000000..53c4c7ea05e8 --- /dev/null +++ b/sdk/blockchain/azure-mgmt-blockchain/azure/mgmt/blockchain/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 = "2.0.0" +