diff --git a/src/blockchain/azext_blockchain/__init__.py b/src/blockchain/azext_blockchain/__init__.py index 661492f2bbc..434f793fd7e 100644 --- a/src/blockchain/azext_blockchain/__init__.py +++ b/src/blockchain/azext_blockchain/__init__.py @@ -10,18 +10,22 @@ from azure.cli.core import AzCommandsLoader from azext_blockchain.generated._help import helps # pylint: disable=unused-import +try: + from azext_blockchain.manual._help import helps # pylint: disable=reimported +except ImportError: + pass class BlockchainManagementClientCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azext_blockchain.generated._client_factory import cf_blockchain + from azext_blockchain.generated._client_factory import cf_blockchain_cl blockchain_custom = CliCommandType( operations_tmpl='azext_blockchain.custom#{}', - client_factory=cf_blockchain) - super(BlockchainManagementClientCommandsLoader, self).__init__(cli_ctx=cli_ctx, - custom_command_type=blockchain_custom) + client_factory=cf_blockchain_cl) + parent = super(BlockchainManagementClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=blockchain_custom) def load_command_table(self, args): from azext_blockchain.generated.commands import load_command_table diff --git a/src/blockchain/azext_blockchain/azext_metadata.json b/src/blockchain/azext_blockchain/azext_metadata.json index 13025150393..cfc30c747c7 100644 --- a/src/blockchain/azext_blockchain/azext_metadata.json +++ b/src/blockchain/azext_blockchain/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.3.1" + "azext.minCliCoreVersion": "2.15.0" } \ No newline at end of file diff --git a/src/blockchain/azext_blockchain/generated/_client_factory.py b/src/blockchain/azext_blockchain/generated/_client_factory.py index fc58c28046a..c0b4075f510 100644 --- a/src/blockchain/azext_blockchain/generated/_client_factory.py +++ b/src/blockchain/azext_blockchain/generated/_client_factory.py @@ -9,19 +9,28 @@ # -------------------------------------------------------------------------- -def cf_blockchain(cli_ctx, *_): +def cf_blockchain_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client - from ..vendored_sdks.blockchain import BlockchainManagementClient - return get_mgmt_service_client(cli_ctx, BlockchainManagementClient) + from azext_blockchain.vendored_sdks.blockchain import BlockchainManagementClient + return get_mgmt_service_client(cli_ctx, + BlockchainManagementClient) -def cf_member(cli_ctx, *_): - return cf_blockchain(cli_ctx).blockchain_member +def cf_blockchain_member(cli_ctx, *_): + return cf_blockchain_cl(cli_ctx).blockchain_members -def cf_consortium(cli_ctx, *_): - return cf_blockchain(cli_ctx).location +def cf_blockchain_member_operation_result(cli_ctx, *_): + return cf_blockchain_cl(cli_ctx).blockchain_member_operation_results + + +def cf_location(cli_ctx, *_): + return cf_blockchain_cl(cli_ctx).locations + + +def cf_sku(cli_ctx, *_): + return cf_blockchain_cl(cli_ctx).skus def cf_transaction_node(cli_ctx, *_): - return cf_blockchain(cli_ctx).transaction_node + return cf_blockchain_cl(cli_ctx).transaction_nodes diff --git a/src/blockchain/azext_blockchain/generated/_help.py b/src/blockchain/azext_blockchain/generated/_help.py index 98affe4b33b..16b7d9dc941 100644 --- a/src/blockchain/azext_blockchain/generated/_help.py +++ b/src/blockchain/azext_blockchain/generated/_help.py @@ -12,219 +12,288 @@ from knack.help_files import helps -helps['blockchain member'] = """ +helps['blockchain blockchain-member'] = """ type: group - short-summary: blockchain member + short-summary: Manage blockchain member with blockchain """ -helps['blockchain member list'] = """ +helps['blockchain blockchain-member list'] = """ type: command - short-summary: List the blockchain members. + short-summary: "Lists the blockchain members for a resource group." examples: - - name: List the blockchain members in a resource group. + - name: BlockchainMembers_List text: |- - az blockchain member list --resource-group "mygroup" + az blockchain blockchain-member list --resource-group "mygroup" """ -helps['blockchain member show'] = """ +helps['blockchain blockchain-member show'] = """ type: command - short-summary: Show the details about a blockchain member. + short-summary: "Get details about a blockchain member." examples: - - name: Show the details about a blockchain member. + - name: BlockchainMembers_Get text: |- - az blockchain member show --name "contosemember1" --resource-group "mygroup" + az blockchain blockchain-member show --name "contosemember1" --resource-group "mygroup" """ -helps['blockchain member create'] = """ +helps['blockchain blockchain-member create'] = """ type: command - short-summary: Create a blockchain member. + short-summary: "Create a blockchain member." parameters: + - name: --sku + short-summary: "Gets or sets the blockchain member Sku." + long-summary: | + Usage: --sku name=XX tier=XX + + name: Gets or sets Sku name + tier: Gets or sets Sku tier - name: --firewall-rules - short-summary: Firewall rules of the blockchian member. + short-summary: "Gets or sets firewall rules" long-summary: | - Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rule-name, start-ip-address, end-ip-address. + Usage: --firewall-rules rule-name=XX start-ip-address=XX end-ip-address=XX + + rule-name: Gets or sets the name of the firewall rules. + start-ip-address: Gets or sets the start IP address of the firewall rule range. + end-ip-address: Gets or sets the end IP address of the firewall rule range. - Multiple firewall rules can be specified by using more than one `--firewall-rules` argument. + Multiple actions can be specified by using more than one --firewall-rules argument. examples: - - name: Create a blockchain member. + - name: BlockchainMembers_Create text: |- - az blockchain member create --location "southeastasia" --consortium "ContoseConsortium" --consortium-man\ -agement-account-password "1234abcdEFG1" --password "1234abcdEFG1" --validator-nodes-sku capacity=2 --protocol "Quorum" \ ---name "contosemember1" --resource-group "mygroup" + az blockchain blockchain-member create --location "southeastasia" --consortium "ContoseConsortium" \ +--consortium-management-account-password "" --password "" --capacity 2 \ +--protocol "Quorum" --name "contosemember1" --resource-group "mygroup" """ -helps['blockchain member update'] = """ +helps['blockchain blockchain-member update'] = """ type: command - short-summary: Update a blockchain member. + short-summary: "Update a blockchain member." parameters: - name: --firewall-rules - short-summary: Firewall rules of the blockchian member. + short-summary: "Gets or sets the firewall rules." long-summary: | - Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rule-name, start-ip-address, end-ip-address. + Usage: --firewall-rules rule-name=XX start-ip-address=XX end-ip-address=XX + + rule-name: Gets or sets the name of the firewall rules. + start-ip-address: Gets or sets the start IP address of the firewall rule range. + end-ip-address: Gets or sets the end IP address of the firewall rule range. + + Multiple actions can be specified by using more than one --firewall-rules argument. + examples: + - name: BlockchainMembers_Update + text: |- + az blockchain blockchain-member update --consortium-management-account-password \ +"" --password "" --name "ContoseMember1" --resource-group "mygroup" +""" + +helps['blockchain blockchain-member delete'] = """ + type: command + short-summary: "Delete a blockchain member." + examples: + - name: BlockchainMembers_Delete + text: |- + az blockchain blockchain-member delete --name "contosemember1" --resource-group "mygroup" +""" - Multiple firewall rules can be specified by using more than one `--firewall-rules` argument. +helps['blockchain blockchain-member list-all'] = """ + type: command + short-summary: "Lists the blockchain members for a subscription." examples: - - name: Update a blockchain member. + - name: BlockchainMembers_ListAll text: |- - az blockchain member update --consortium-management-account-password "1234abcdEFG1" --password "1234abcd\ -EFG1" --name "ContoseMember1" --resource-group "mygroup" + az blockchain blockchain-member list-all """ -helps['blockchain member delete'] = """ +helps['blockchain blockchain-member list-api-key'] = """ type: command - short-summary: Delete a blockchain member. + short-summary: "Lists the API keys for a blockchain member." examples: - - name: Delete a blockchain member. + - name: BlockchainMembers_ListApiKeys text: |- - az blockchain member delete --name "contosemember1" --resource-group "mygroup" + az blockchain blockchain-member list-api-key --name "contosemember1" --resource-group "mygroup" """ -helps['blockchain member wait'] = """ +helps['blockchain blockchain-member list-consortium-member'] = """ type: command - short-summary: Wait until a blockchain member is created or deleted. + short-summary: "Lists the consortium members for a blockchain member." examples: - - name: Wait until a blockchain member is created. + - name: BlockchainMembers_ListConsortiumMembers text: |- - az blockchain member wait --name "contosemember1" --resource-group "mygroup" --created + az blockchain blockchain-member list-consortium-member --name "contosemember1" --resource-group \ +"mygroup" """ -helps['blockchain member list-api-key'] = """ +helps['blockchain blockchain-member regenerate-api-key'] = """ type: command - short-summary: List the API keys for a blockchain member. + short-summary: "Regenerate the API keys for a blockchain member." examples: - - name: List the API keys for a blockchain member. + - name: BlockchainMembers_ListRegenerateApiKeys text: |- - az blockchain member list-api-key --name "contosemember1" --resource-group "mygroup" + az blockchain blockchain-member regenerate-api-key --key-name "key1" --name "contosemember1" \ +--resource-group "mygroup" """ -helps['blockchain member list-consortium-member'] = """ +helps['blockchain blockchain-member wait'] = """ type: command - short-summary: List the consortium members for a blockchain member. + short-summary: Place the CLI in a waiting state until a condition of the blockchain blockchain-member is met. examples: - - name: List the consortium members for a blockchain member. + - name: Pause executing next line of CLI script until the blockchain blockchain-member is successfully created. text: |- - az blockchain member list-consortium-member --name "contosemember1" --resource-group "\ -mygroup" + az blockchain blockchain-member wait --name "contosemember1" --resource-group "mygroup" --created + - name: Pause executing next line of CLI script until the blockchain blockchain-member is successfully deleted. + text: |- + az blockchain blockchain-member wait --name "contosemember1" --resource-group "mygroup" --deleted +""" + +helps['blockchain blockchain-member-operation-result'] = """ + type: group + short-summary: Manage blockchain member operation result with blockchain """ -helps['blockchain member regenerate-api-key'] = """ +helps['blockchain blockchain-member-operation-result show'] = """ type: command - short-summary: Regenerate the API keys for a blockchain member. + short-summary: "Get Async operation result." examples: - - name: Regenerate the API keys for a blockchain member. + - name: BlockchainMemberOperationResults_Get text: |- - az blockchain member regenerate-api-key --key-name "key1" --name "contosemember1" --re\ -source-group "mygroup" + az blockchain blockchain-member-operation-result show --operation-id "12f4b309-01e3-4fcf-bc0b-1cc034ca03\ +f8" --location-name "southeastasia" """ helps['blockchain consortium'] = """ type: group - short-summary: blockchain consortium + short-summary: Manage consortium with blockchain """ helps['blockchain consortium list'] = """ type: command - short-summary: List the available consortiums for a subscription. + short-summary: "Lists the available consortiums for a subscription." examples: - - name: List the available consortiums for a subscription. + - name: Locations_ListConsortiums text: |- - az blockchain consortium list --location "southeastasia" + az blockchain consortium list --name "southeastasia" +""" + +helps['blockchain sku'] = """ + type: group + short-summary: Manage sku with blockchain +""" + +helps['blockchain sku list'] = """ + type: command + short-summary: "Lists the Skus of the resource type." + examples: + - name: Skus_List + text: |- + az blockchain sku list """ helps['blockchain transaction-node'] = """ type: group - short-summary: blockchain transaction-node + short-summary: Manage transaction node with blockchain """ helps['blockchain transaction-node list'] = """ type: command - short-summary: List the transaction nodes for a blockchain member. + short-summary: "Lists the transaction nodes for a blockchain member." examples: - - name: List the transaction nodes for a blockchain member. + - name: TransactionNodes_List text: |- - az blockchain transaction-node list --member-name "contosemember1" --resource-group "mygroup" + az blockchain transaction-node list --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" """ helps['blockchain transaction-node show'] = """ type: command - short-summary: Show the details of the transaction node. + short-summary: "Get the details of the transaction node." examples: - - name: Show the details of the transaction node. + - name: TransactionNodes_Get text: |- - az blockchain transaction-node show --member-name "contosemember1" --resource-group "mygroup"\ - --name "txnode2" + az blockchain transaction-node show --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --name "txnode2" """ helps['blockchain transaction-node create'] = """ type: command - short-summary: Create a transaction node. + short-summary: "Create or update the transaction node." parameters: - name: --firewall-rules - short-summary: Firewall rules of the blockchian transaction node. + short-summary: "Gets or sets the firewall rules." long-summary: | - Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rule-name, start-ip-address, end-ip-address. + Usage: --firewall-rules rule-name=XX start-ip-address=XX end-ip-address=XX + + rule-name: Gets or sets the name of the firewall rules. + start-ip-address: Gets or sets the start IP address of the firewall rule range. + end-ip-address: Gets or sets the end IP address of the firewall rule range. - Multiple firewall rules can be specified by using more than one `--firewall-rules` argument. + Multiple actions can be specified by using more than one --firewall-rules argument. examples: - - name: Create a transaction node. + - name: TransactionNodes_Create text: |- - az blockchain transaction-node create --member-name "contosemember1" --resource-group "mygrou\ -p" --location "southeastasia" --password "1234abcdEFG1" --name "txnode2" + az blockchain transaction-node create --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --location "southeastasia" --password "" --name "txnode2" """ helps['blockchain transaction-node update'] = """ type: command - short-summary: Update the transaction node. + short-summary: "Update the transaction node." parameters: - name: --firewall-rules - short-summary: Firewall rules of the blockchian transaction node. + short-summary: "Gets or sets the firewall rules." long-summary: | - Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: rule-name, start-ip-address, end-ip-address. + Usage: --firewall-rules rule-name=XX start-ip-address=XX end-ip-address=XX - Multiple firewall rules can be specified by using more than one `--firewall-rules` argument. + rule-name: Gets or sets the name of the firewall rules. + start-ip-address: Gets or sets the start IP address of the firewall rule range. + end-ip-address: Gets or sets the end IP address of the firewall rule range. + + Multiple actions can be specified by using more than one --firewall-rules argument. examples: - - name: Update the transaction node. + - name: TransactionNodes_Update text: |- - az blockchain transaction-node update --member-name "contosemember1" --resource-group "mygrou\ -p" --password "1234abcdEFG1" --name "txnode2" + az blockchain transaction-node update --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --password "" --name "txnode2" """ helps['blockchain transaction-node delete'] = """ type: command - short-summary: Delete the transaction node. + short-summary: "Delete the transaction node." examples: - - name: Delete the transaction node. + - name: TransactionNodes_Delete text: |- - az blockchain transaction-node delete --member-name "contosemember1" --resource-group "mygrou\ -p" --name "txNode2" + az blockchain transaction-node delete --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --name "txNode2" """ -helps['blockchain transaction-node wait'] = """ +helps['blockchain transaction-node list-api-key'] = """ type: command - short-summary: Wait until the transaction node is created or deleted. + short-summary: "List the API keys for the transaction node." examples: - - name: Wait until the transaction node is created. + - name: TransactionNodes_ListApiKeys text: |- - az blockchain transaction-node wait --member-name "contosemember1" --resource-group "mygrou\ -p" --name "txNode2" --created + az blockchain transaction-node list-api-key --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --name "txnode2" """ -helps['blockchain transaction-node list-api-key'] = """ +helps['blockchain transaction-node regenerate-api-key'] = """ type: command - short-summary: List the API keys for the transaction node. + short-summary: "Regenerate the API keys for the blockchain member." examples: - - name: List the API keys for the transaction node. + - name: TransactionNodes_ListRegenerateApiKeys text: |- - az blockchain transaction-node list-api-key --member-name "contosemember1" --resource-group "\ -mygroup" --name "txnode2" + az blockchain transaction-node regenerate-api-key --key-name "key1" --blockchain-member-name \ +"contosemember1" --resource-group "mygroup" --name "txnode2" """ -helps['blockchain transaction-node regenerate-api-key'] = """ +helps['blockchain transaction-node wait'] = """ type: command - short-summary: Regenerate the API keys for the blockchain member. + short-summary: Place the CLI in a waiting state until a condition of the blockchain transaction-node is met. examples: - - name: Regenerate the API keys for the blockchain member. + - name: Pause executing next line of CLI script until the blockchain transaction-node is successfully created. + text: |- + az blockchain transaction-node wait --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --name "txnode2" --created + - name: Pause executing next line of CLI script until the blockchain transaction-node is successfully deleted. text: |- - az blockchain transaction-node regenerate-api-key --key-name "key1" --member-name "contosemem\ -ber1" --resource-group "mygroup" --name "txnode2" + az blockchain transaction-node wait --blockchain-member-name "contosemember1" --resource-group \ +"mygroup" --name "txnode2" --deleted """ diff --git a/src/blockchain/azext_blockchain/generated/_params.py b/src/blockchain/azext_blockchain/generated/_params.py index 948bdc59af0..1a252781caf 100644 --- a/src/blockchain/azext_blockchain/generated/_params.py +++ b/src/blockchain/azext_blockchain/generated/_params.py @@ -17,10 +17,9 @@ get_location_type ) from azure.cli.core.commands.validators import get_default_location_from_resource_group -from azext_blockchain.generated._validators import process_blockchain_member_sku from azext_blockchain.action import ( - AddValidatorNodesSku, - AddBlockchainMemberCreateFirewallRules, + AddSku, + AddBlockchainBlockchainMemberCreateFirewallRules, AddBlockchainTransactionNodeUpdateFirewallRules, AddBlockchainTransactionNodeCreateFirewallRules ) @@ -28,105 +27,132 @@ def load_arguments(self, _): - with self.argument_context('blockchain member list') as c: + with self.argument_context('blockchain blockchain-member list') as c: c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain member') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + with self.argument_context('blockchain blockchain-member show') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.', id_part='name') c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain member create') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + with self.argument_context('blockchain blockchain-member create') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.') c.argument('resource_group_name', resource_group_name_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) c.argument('tags', tags_type) - c.argument('sku', arg_type=get_enum_type(['Basic', 'Standard']), - help='The Sku of the blockchain member', validator=process_blockchain_member_sku) - c.argument('protocol', arg_type=get_enum_type(['NotSpecified', 'Parity', 'Quorum', 'Corda']), help='Gets or set' - 's the blockchain protocol.') - c.argument('validator_nodes_sku', action=AddValidatorNodesSku, nargs='+', help='Gets or sets the blockchain val' - 'idator nodes Sku. Expect value: capacity=xx.') - c.argument('password', help='Sets the basic auth password of the blockchain member.') - c.argument('consortium', help='Gets or sets the consortium for the blockchain member.') - c.argument('consortium_management_account_password', help='Sets the managed consortium management account passw' - 'ord.') - c.argument('consortium_role', help='Gets the role of the member in the consortium.') - c.argument('consortium_member_display_name', help='Gets the display name of the member in the consortium.') - c.argument('firewall_rules', action=AddBlockchainMemberCreateFirewallRules, nargs='+') - - with self.argument_context('blockchain member update') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + c.argument('sku', action=AddSku, nargs='+', help='Gets or sets the blockchain member Sku.') + c.argument('protocol', arg_type=get_enum_type(['NotSpecified', 'Parity', 'Quorum', 'Corda']), help='Gets or ' + 'sets the blockchain protocol.') + c.argument('password', type=str, help='Sets the basic auth password of the blockchain member.') + c.argument('consortium', type=str, help='Gets or sets the consortium for the blockchain member.') + c.argument('consortium_management_account_password', type=str, help='Sets the managed consortium management ' + 'account password.') + c.argument('consortium_role', type=str, help='Gets the role of the member in the consortium.') + c.argument('consortium_member_display_name', type=str, help='Gets the display name of the member in the ' + 'consortium.') + c.argument('firewall_rules', action=AddBlockchainBlockchainMemberCreateFirewallRules, nargs='+', help='Gets or ' + 'sets firewall rules') + c.argument('capacity', type=int, help='Gets or sets the nodes capacity.', arg_group='Validator Nodes Sku') + + with self.argument_context('blockchain blockchain-member update') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.', id_part='name') c.argument('resource_group_name', resource_group_name_type) c.argument('tags', tags_type) - c.argument('password', help='Sets the transaction node dns endpoint basic auth password.') - c.argument('firewall_rules', action=AddBlockchainTransactionNodeUpdateFirewallRules, nargs='+') - c.argument('consortium_management_account_password', help='Sets the managed consortium management account passw' - 'ord.') - - with self.argument_context('blockchain member delete') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name') + c.argument('password', type=str, help='Sets the transaction node dns endpoint basic auth password.') + c.argument('firewall_rules', action=AddBlockchainTransactionNodeUpdateFirewallRules, nargs='+', help='Gets or ' + 'sets the firewall rules.') + c.argument('consortium_management_account_password', type=str, help='Sets the managed consortium management ' + 'account password.') + + with self.argument_context('blockchain blockchain-member delete') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name', id_part='name') c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain member list-all') as c: - pass + with self.argument_context('blockchain blockchain-member list-api-key') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.') + c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain member list-api-key') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + with self.argument_context('blockchain blockchain-member list-consortium-member') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.') c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain member list-consortium-member') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + with self.argument_context('blockchain blockchain-member regenerate-api-key') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.', id_part='name') c.argument('resource_group_name', resource_group_name_type) + c.argument('key_name', type=str, help='Gets or sets the API key name.') + c.argument('value', type=str, help='Gets or sets the API key value.') - with self.argument_context('blockchain member regenerate-api-key') as c: - c.argument('blockchain_member_name', options_list=['--name', '-n'], help='Blockchain member name.') + with self.argument_context('blockchain blockchain-member wait') as c: + c.argument('blockchain_member_name', options_list=['--name', '-n', '--blockchain-member-name'], type=str, + help='Blockchain member name.', id_part='name') c.argument('resource_group_name', resource_group_name_type) - c.argument('key_name', help='Gets or sets the API key name.', - arg_type=get_enum_type(['key1', 'key2'])) + + with self.argument_context('blockchain blockchain-member-operation-result show') as c: + c.argument('location_name', type=str, help='Location name.') + c.argument('operation_id', type=str, help='Operation Id.', id_part='child_name_1') with self.argument_context('blockchain consortium list') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx)) + c.argument('location_name', options_list=['--name', '-n', '--location-name'], type=str, help='Location Name.') with self.argument_context('blockchain transaction-node list') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.') c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('blockchain transaction-node') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + with self.argument_context('blockchain transaction-node show') as c: + c.argument('blockchain_member_name', type=str, help='Blockchain member name.', id_part='name') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.', id_part='child_name_1') c.argument('resource_group_name', resource_group_name_type) with self.argument_context('blockchain transaction-node create') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.') c.argument('resource_group_name', resource_group_name_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('password', help='Sets the transaction node dns endpoint basic auth password.') - c.argument('firewall_rules', action=AddBlockchainTransactionNodeCreateFirewallRules, nargs='+') + c.argument('password', type=str, help='Sets the transaction node dns endpoint basic auth password.') + c.argument('firewall_rules', action=AddBlockchainTransactionNodeCreateFirewallRules, nargs='+', help='Gets or ' + 'sets the firewall rules.') with self.argument_context('blockchain transaction-node update') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.', id_part='name') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.', id_part='child_name_1') c.argument('resource_group_name', resource_group_name_type) - c.argument('password', help='Sets the transaction node dns endpoint basic auth password.') - c.argument('firewall_rules', action=AddBlockchainTransactionNodeUpdateFirewallRules, nargs='+') + c.argument('password', type=str, help='Sets the transaction node dns endpoint basic auth password.') + c.argument('firewall_rules', action=AddBlockchainTransactionNodeUpdateFirewallRules, nargs='+', help='Gets or ' + 'sets the firewall rules.') with self.argument_context('blockchain transaction-node delete') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.', id_part='name') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.', id_part='child_name_1') c.argument('resource_group_name', resource_group_name_type) with self.argument_context('blockchain transaction-node list-api-key') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.') c.argument('resource_group_name', resource_group_name_type) with self.argument_context('blockchain transaction-node regenerate-api-key') as c: - c.argument('blockchain_member_name', options_list=['--member-name'], help='Blockchain member name.') - c.argument('transaction_node_name', options_list=['--name', '-n'], help='Transaction node name.') + c.argument('blockchain_member_name', type=str, help='Blockchain member name.', id_part='name') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.', id_part='child_name_1') + c.argument('resource_group_name', resource_group_name_type) + c.argument('key_name', type=str, help='Gets or sets the API key name.') + c.argument('value', type=str, help='Gets or sets the API key value.') + + with self.argument_context('blockchain transaction-node wait') as c: + c.argument('blockchain_member_name', type=str, help='Blockchain member name.', id_part='name') + c.argument('transaction_node_name', options_list=['--name', '-n', '--transaction-node-name'], type=str, + help='Transaction node name.', id_part='child_name_1') c.argument('resource_group_name', resource_group_name_type) - c.argument('key_name', help='Gets or sets the API key name.', - arg_type=get_enum_type(['key1', 'key2'])) - c.argument('value', help='Gets or sets the API key value.') diff --git a/src/blockchain/azext_blockchain/generated/_validators.py b/src/blockchain/azext_blockchain/generated/_validators.py index 5dee7c0d975..b33a44c1ebf 100644 --- a/src/blockchain/azext_blockchain/generated/_validators.py +++ b/src/blockchain/azext_blockchain/generated/_validators.py @@ -7,16 +7,3 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- - - -def process_blockchain_member_sku(namespace): - if namespace.sku == "Basic": - namespace.sku = { - 'name': 'B0', - 'tier': 'Basic' - } - else: - namespace.sku = { - 'name': 'S0', - 'tier': 'Standard' - } diff --git a/src/blockchain/azext_blockchain/generated/action.py b/src/blockchain/azext_blockchain/generated/action.py index 41e25cd3557..c902856fd42 100644 --- a/src/blockchain/azext_blockchain/generated/action.py +++ b/src/blockchain/azext_blockchain/generated/action.py @@ -10,14 +10,14 @@ # pylint: disable=protected-access import argparse -from knack.util import CLIError from collections import defaultdict +from knack.util import CLIError -class AddValidatorNodesSku(argparse.Action): +class AddSku(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - namespace.validator_nodes_sku = action + namespace.sku = action def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -31,15 +31,20 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use for k in properties: kl = k.lower() v = properties[k] - if kl == 'capacity': - d['capacity'] = v[0] + if kl == 'name': + d['name'] = v[0] + elif kl == 'tier': + d['tier'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, tier'. + format(k)) return d -class AddBlockchainMemberCreateFirewallRules(argparse._AppendAction): +class AddBlockchainBlockchainMemberCreateFirewallRules(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) - super(AddBlockchainMemberCreateFirewallRules, self).__call__(parser, namespace, action, option_string) + super(AddBlockchainBlockchainMemberCreateFirewallRules, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use try: @@ -59,6 +64,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['start_ip_address'] = v[0] elif kl == 'end-ip-address': d['end_ip_address'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter firewall_rules. All possible keys are: ' + 'rule-name, start-ip-address, end-ip-address'.format(k)) return d @@ -85,6 +93,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['start_ip_address'] = v[0] elif kl == 'end-ip-address': d['end_ip_address'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter firewall_rules. All possible keys are: ' + 'rule-name, start-ip-address, end-ip-address'.format(k)) return d @@ -111,4 +122,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use d['start_ip_address'] = v[0] elif kl == 'end-ip-address': d['end_ip_address'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter firewall_rules. All possible keys are: ' + 'rule-name, start-ip-address, end-ip-address'.format(k)) return d diff --git a/src/blockchain/azext_blockchain/generated/commands.py b/src/blockchain/azext_blockchain/generated/commands.py index def63fcfa79..96ff917300b 100644 --- a/src/blockchain/azext_blockchain/generated/commands.py +++ b/src/blockchain/azext_blockchain/generated/commands.py @@ -7,45 +7,64 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals from azure.cli.core.commands import CliCommandType def load_command_table(self, _): - from azext_blockchain.generated._client_factory import cf_member - blockchain_member = CliCommandType( - operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._blockchain_member_operations#BlockchainM' - 'emberOperations.{}', - client_factory=cf_member) - with self.command_group('blockchain member', blockchain_member, client_factory=cf_member, - is_experimental=True) as g: - g.custom_command('list', 'blockchain_member_list') - g.custom_show_command('show', 'blockchain_member_show') - g.custom_command('create', 'blockchain_member_create', supports_no_wait=True) - g.custom_command('update', 'blockchain_member_update') - g.custom_command('delete', 'blockchain_member_delete', supports_no_wait=True, confirmation=True) - g.custom_command('list-api-key', 'blockchain_member_list_api_key') - g.custom_command('list-consortium-member', 'blockchain_member_list_consortium_member') - g.custom_command('regenerate-api-key', 'blockchain_member_regenerate_api_key') - g.wait_command('wait') - - from azext_blockchain.generated._client_factory import cf_consortium - blockchain_consortium = CliCommandType( - operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._location_operations#LocationOperations.{' - '}', - client_factory=cf_consortium) - with self.command_group('blockchain consortium', blockchain_consortium, client_factory=cf_consortium, - is_experimental=True) as g: + from azext_blockchain.generated._client_factory import cf_blockchain_member + blockchain_blockchain_member = CliCommandType( + operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._blockchain_members_operations#Blockchain' + 'MembersOperations.{}', + client_factory=cf_blockchain_member) + with self.command_group('blockchain blockchain-member', blockchain_blockchain_member, + client_factory=cf_blockchain_member) as g: + g.custom_command('list', 'blockchain_blockchain_member_list') + g.custom_show_command('show', 'blockchain_blockchain_member_show') + g.custom_command('create', 'blockchain_blockchain_member_create', supports_no_wait=True) + g.custom_command('update', 'blockchain_blockchain_member_update') + g.custom_command('delete', 'blockchain_blockchain_member_delete', supports_no_wait=True, confirmation=True) + g.custom_command('list-all', 'blockchain_blockchain_member_list_all') + g.custom_command('list-api-key', 'blockchain_blockchain_member_list_api_key') + g.custom_command('list-consortium-member', 'blockchain_blockchain_member_list_consortium_member') + g.custom_command('regenerate-api-key', 'blockchain_blockchain_member_regenerate_api_key') + g.custom_wait_command('wait', 'blockchain_blockchain_member_show') + + from azext_blockchain.generated._client_factory import cf_blockchain_member_operation_result + blockchain_blockchain_member_operation_result = CliCommandType( + operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._blockchain_member_operation_results_oper' + 'ations#BlockchainMemberOperationResultsOperations.{}', + client_factory=cf_blockchain_member_operation_result) + with self.command_group('blockchain blockchain-member-operation-result', + blockchain_blockchain_member_operation_result, + client_factory=cf_blockchain_member_operation_result) as g: + g.custom_show_command('show', 'blockchain_blockchain_member_operation_result_show') + + from azext_blockchain.generated._client_factory import cf_location + blockchain_location = CliCommandType( + operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._locations_operations#LocationsOperations' + '.{}', + client_factory=cf_location) + with self.command_group('blockchain consortium', blockchain_location, client_factory=cf_location) as g: g.custom_command('list', 'blockchain_consortium_list') + from azext_blockchain.generated._client_factory import cf_sku + blockchain_sku = CliCommandType( + operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._skus_operations#SkusOperations.{}', + client_factory=cf_sku) + with self.command_group('blockchain sku', blockchain_sku, client_factory=cf_sku) as g: + g.custom_command('list', 'blockchain_sku_list') + from azext_blockchain.generated._client_factory import cf_transaction_node blockchain_transaction_node = CliCommandType( - operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._transaction_node_operations#TransactionN' - 'odeOperations.{}', + operations_tmpl='azext_blockchain.vendored_sdks.blockchain.operations._transaction_nodes_operations#Transaction' + 'NodesOperations.{}', client_factory=cf_transaction_node) with self.command_group('blockchain transaction-node', blockchain_transaction_node, - client_factory=cf_transaction_node, is_experimental=True) as g: + client_factory=cf_transaction_node) as g: g.custom_command('list', 'blockchain_transaction_node_list') g.custom_show_command('show', 'blockchain_transaction_node_show') g.custom_command('create', 'blockchain_transaction_node_create', supports_no_wait=True) @@ -53,4 +72,7 @@ def load_command_table(self, _): g.custom_command('delete', 'blockchain_transaction_node_delete', supports_no_wait=True, confirmation=True) g.custom_command('list-api-key', 'blockchain_transaction_node_list_api_key') g.custom_command('regenerate-api-key', 'blockchain_transaction_node_regenerate_api_key') - g.wait_command('wait') + g.custom_wait_command('wait', 'blockchain_transaction_node_show') + + with self.command_group('blockchain', is_experimental=True): + pass diff --git a/src/blockchain/azext_blockchain/generated/custom.py b/src/blockchain/azext_blockchain/generated/custom.py index b90a8e7c04c..22ecbe5f49f 100644 --- a/src/blockchain/azext_blockchain/generated/custom.py +++ b/src/blockchain/azext_blockchain/generated/custom.py @@ -12,97 +12,125 @@ from azure.cli.core.util import sdk_no_wait -def blockchain_member_list(client, - resource_group_name=None): - if resource_group_name: - return client.list(resource_group_name=resource_group_name) - return client.list_all() +def blockchain_blockchain_member_list(client, + resource_group_name): + return client.list(resource_group_name=resource_group_name) -def blockchain_member_show(client, - blockchain_member_name, - resource_group_name): +def blockchain_blockchain_member_show(client, + blockchain_member_name, + resource_group_name): return client.get(blockchain_member_name=blockchain_member_name, resource_group_name=resource_group_name) -def blockchain_member_create(client, - blockchain_member_name, - resource_group_name, - location=None, - tags=None, - sku=None, - protocol=None, - validator_nodes_sku=None, - password=None, - consortium=None, - consortium_management_account_password=None, - firewall_rules=None, - no_wait=False): - return sdk_no_wait(no_wait, client.begin_create, +def blockchain_blockchain_member_create(client, + blockchain_member_name, + resource_group_name, + location=None, + tags=None, + sku=None, + protocol=None, + password=None, + consortium=None, + consortium_management_account_password=None, + consortium_role=None, + consortium_member_display_name=None, + firewall_rules=None, + capacity=None, + no_wait=False): + blockchain_member = {} + blockchain_member['location'] = location + blockchain_member['tags'] = tags + blockchain_member['sku'] = sku + blockchain_member['protocol'] = protocol + blockchain_member['password'] = password + blockchain_member['consortium'] = consortium + blockchain_member['consortium_management_account_password'] = consortium_management_account_password + blockchain_member['consortium_role'] = consortium_role + blockchain_member['consortium_member_display_name'] = consortium_member_display_name + blockchain_member['firewall_rules'] = firewall_rules + blockchain_member['validator_nodes_sku'] = {} + blockchain_member['validator_nodes_sku']['capacity'] = capacity + return sdk_no_wait(no_wait, + client.begin_create, blockchain_member_name=blockchain_member_name, resource_group_name=resource_group_name, - location=location, - tags=tags, - sku=sku, - protocol=protocol, - validator_nodes_sku=validator_nodes_sku, - password=password, - consortium=consortium, - consortium_management_account_password=consortium_management_account_password, - firewall_rules=firewall_rules) - - -def blockchain_member_update(client, - blockchain_member_name, - resource_group_name, - tags=None, - password=None, - firewall_rules=None, - consortium_management_account_password=None): + blockchain_member=blockchain_member) + + +def blockchain_blockchain_member_update(client, + blockchain_member_name, + resource_group_name, + tags=None, + password=None, + firewall_rules=None, + consortium_management_account_password=None): + blockchain_member = {} + blockchain_member['tags'] = tags + blockchain_member['password'] = password + blockchain_member['firewall_rules'] = firewall_rules + blockchain_member['consortium_management_account_password'] = consortium_management_account_password return client.update(blockchain_member_name=blockchain_member_name, resource_group_name=resource_group_name, - tags=tags, - password=password, - firewall_rules=firewall_rules, - consortium_management_account_password=consortium_management_account_password) + blockchain_member=blockchain_member) -def blockchain_member_delete(client, - blockchain_member_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, client.begin_delete, +def blockchain_blockchain_member_delete(client, + blockchain_member_name, + resource_group_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, blockchain_member_name=blockchain_member_name, resource_group_name=resource_group_name) -def blockchain_member_list_api_key(client, - blockchain_member_name, - resource_group_name): - return client.list_api_key(blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name) +def blockchain_blockchain_member_list_all(client): + return client.list_all() -def blockchain_member_list_consortium_member(client, - blockchain_member_name, - resource_group_name): - return client.list_consortium_member(blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name) +def blockchain_blockchain_member_list_api_key(client, + blockchain_member_name, + resource_group_name): + return client.list_api_keys(blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name) + +def blockchain_blockchain_member_list_consortium_member(client, + blockchain_member_name, + resource_group_name): + return client.list_consortium_members(blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name) -def blockchain_member_regenerate_api_key(client, - blockchain_member_name, - resource_group_name, - key_name=None): - return client.regenerate_api_key(blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name, - key_name=key_name) + +def blockchain_blockchain_member_regenerate_api_key(client, + blockchain_member_name, + resource_group_name, + key_name=None, + value=None): + api_key = {} + api_key['key_name'] = key_name + api_key['value'] = value + return client.regenerate_api_keys(blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + api_key=api_key) + + +def blockchain_blockchain_member_operation_result_show(client, + location_name, + operation_id): + return client.get(location_name=location_name, + operation_id=operation_id) def blockchain_consortium_list(client, - location): - return client.list_consortium(location_name=location) + location_name): + return client.list_consortiums(location_name=location_name) + + +def blockchain_sku_list(client): + return client.list() def blockchain_transaction_node_list(client, @@ -129,13 +157,16 @@ def blockchain_transaction_node_create(client, password=None, firewall_rules=None, no_wait=False): - return sdk_no_wait(no_wait, client.begin_create, + transaction_node = {} + transaction_node['location'] = location + transaction_node['password'] = password + transaction_node['firewall_rules'] = firewall_rules + return sdk_no_wait(no_wait, + client.begin_create, blockchain_member_name=blockchain_member_name, transaction_node_name=transaction_node_name, resource_group_name=resource_group_name, - location=location, - password=password, - firewall_rules=firewall_rules) + transaction_node=transaction_node) def blockchain_transaction_node_update(client, @@ -144,11 +175,13 @@ def blockchain_transaction_node_update(client, resource_group_name, password=None, firewall_rules=None): + transaction_node = {} + transaction_node['password'] = password + transaction_node['firewall_rules'] = firewall_rules return client.update(blockchain_member_name=blockchain_member_name, transaction_node_name=transaction_node_name, resource_group_name=resource_group_name, - password=password, - firewall_rules=firewall_rules) + transaction_node=transaction_node) def blockchain_transaction_node_delete(client, @@ -156,7 +189,8 @@ def blockchain_transaction_node_delete(client, transaction_node_name, resource_group_name, no_wait=False): - return sdk_no_wait(no_wait, client.begin_delete, + return sdk_no_wait(no_wait, + client.begin_delete, blockchain_member_name=blockchain_member_name, transaction_node_name=transaction_node_name, resource_group_name=resource_group_name) @@ -166,9 +200,9 @@ def blockchain_transaction_node_list_api_key(client, blockchain_member_name, transaction_node_name, resource_group_name): - return client.list_api_key(blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name) + return client.list_api_keys(blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_name) def blockchain_transaction_node_regenerate_api_key(client, @@ -177,8 +211,10 @@ def blockchain_transaction_node_regenerate_api_key(client, resource_group_name, key_name=None, value=None): - return client.regenerate_api_key(blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name, - key_name=key_name, - value=value) + api_key = {} + api_key['key_name'] = key_name + api_key['value'] = value + return client.regenerate_api_keys(blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_name, + api_key=api_key) diff --git a/src/blockchain/azext_blockchain/tests/__init__.py b/src/blockchain/azext_blockchain/tests/__init__.py index 29ccafb652b..70488e93851 100644 --- a/src/blockchain/azext_blockchain/tests/__init__.py +++ b/src/blockchain/azext_blockchain/tests/__init__.py @@ -9,17 +9,30 @@ # regenerated. # -------------------------------------------------------------------------- import inspect +import logging import os +import sys +import traceback +import datetime as dt +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) __path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" def try_manual(func): def import_manual_function(origin_func): from importlib import import_module - decorated_path = inspect.getfile(origin_func) - module_path = __path__[0] + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() if not decorated_path.startswith(module_path): raise Exception("Decorator can only be used in submodules!") manual_path = os.path.join( @@ -34,15 +47,70 @@ def get_func_to_call(): func_to_call = func try: func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) except (ImportError, AttributeError): pass return func_to_call def wrapper(*args, **kwargs): func_to_call = get_func_to_call() - print("running {}()...".format(func.__name__)) - return func_to_call(*args, **kwargs) + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret if inspect.isclass(func): return get_func_to_call() return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/blockchain/azext_blockchain/tests/latest/example_steps.py b/src/blockchain/azext_blockchain/tests/latest/example_steps.py new file mode 100644 index 00000000000..406573022a0 --- /dev/null +++ b/src/blockchain/azext_blockchain/tests/latest/example_steps.py @@ -0,0 +1,243 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /BlockchainMemberOperationResults/get/BlockchainMemberOperationResults_Get +@try_manual +def step_blockchain_member_operation_result_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member-operation-result show ' + '--operation-id "12f4b309-01e3-4fcf-bc0b-1cc034ca03f8" ' + '--location-name "{myLocation}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/put/BlockchainMembers_Create +@try_manual +def step_blockchain_member_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member create ' + '--location "{myLocation}" ' + '--consortium "ContoseConsortium" ' + '--consortium-management-account-password "" ' + '--password "" ' + '--capacity 2 ' + '--protocol "Quorum" ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az blockchain blockchain-member wait --created ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_Get +@try_manual +def step_blockchain_member_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member show ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_List +@try_manual +def step_blockchain_member_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_ListAll +@try_manual +def step_blockchain_member_list_all(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member list-all', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_ListConsortiumMembers +@try_manual +def step_blockchain_member_list_consortium_member(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member list-consortium-member ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/patch/BlockchainMembers_Update +@try_manual +def step_blockchain_member_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member update ' + '--consortium-management-account-password "" ' + '--password "" ' + '--name "{myBlockchainMember2}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/post/BlockchainMembers_ListApiKeys +@try_manual +def step_blockchain_member_list_api_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member list-api-key ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/post/BlockchainMembers_ListRegenerateApiKeys +@try_manual +def step_blockchain_member_regenerate_api_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member regenerate-api-key ' + '--key-name "key1" ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /BlockchainMembers/delete/BlockchainMembers_Delete +@try_manual +def step_blockchain_member_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain blockchain-member delete -y ' + '--name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Locations/post/Locations_ListConsortiums +@try_manual +def step_consortium_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain consortium list ' + '--name "{myLocation}"', + checks=checks) + + +# EXAMPLE: /Skus/get/Skus_List +@try_manual +def step_sku_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain sku list', + checks=checks) + + +# EXAMPLE: /TransactionNodes/put/TransactionNodes_Create +@try_manual +def step_transaction_node_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node create ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--location "{myLocation}" ' + '--password "" ' + '--name "{myTransactionNode}"', + checks=[]) + test.cmd('az blockchain transaction-node wait --created ' + '--resource-group "{rg}" ' + '--name "{myTransactionNode}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/get/TransactionNodes_Get +@try_manual +def step_transaction_node_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node show ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--name "{myTransactionNode}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/get/TransactionNodes_List +@try_manual +def step_transaction_node_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node list ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/patch/TransactionNodes_Update +@try_manual +def step_transaction_node_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node update ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--password "" ' + '--name "{myTransactionNode}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/post/TransactionNodes_ListApiKeys +@try_manual +def step_transaction_node_list_api_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node list-api-key ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--name "{myTransactionNode}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/post/TransactionNodes_ListRegenerateApiKeys +@try_manual +def step_transaction_node_regenerate_api_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node regenerate-api-key ' + '--key-name "key1" ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--name "{myTransactionNode}"', + checks=checks) + + +# EXAMPLE: /TransactionNodes/delete/TransactionNodes_Delete +@try_manual +def step_transaction_node_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az blockchain transaction-node delete -y ' + '--blockchain-member-name "{myBlockchainMember}" ' + '--resource-group "{rg}" ' + '--name "{myTransactionNode2}"', + checks=checks) + diff --git a/src/blockchain/azext_blockchain/tests/latest/preparers.py b/src/blockchain/azext_blockchain/tests/latest/preparers.py deleted file mode 100644 index 580507395b5..00000000000 --- a/src/blockchain/azext_blockchain/tests/latest/preparers.py +++ /dev/null @@ -1,119 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 os -from datetime import datetime -from azure_devtools.scenario_tests import SingleValueReplacer - -from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer -from azure.cli.testsdk.exceptions import CliTestError -from azure.cli.testsdk.reverse_dependency import get_dummy_cli - - -KEY_RESOURCE_GROUP = 'rg' -KEY_VIRTUAL_NETWORK = 'vnet' -KEY_VNET_SUBNET = 'subnet' - - -class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='virtual_network', - resource_group_name=None, - resource_group_key=KEY_RESOURCE_GROUP, - dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', - random_name_length=24, key=KEY_VIRTUAL_NETWORK): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VirtualNetworkPreparer, self).__init__( - name_prefix, random_name_length) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group_name = resource_group_name - self.resource_group_key = resource_group_key - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group_name: - self.resource_group_name = self.test_class_instance.kwargs.get( - self.resource_group_key) - if not self.resource_group_name: - raise CliTestError("Error: No resource group configured!") - - tags = {'product': 'azurecli', 'cause': 'automation', - 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} - if 'ENV_JOB_NAME' in os.environ: - tags['job'] = os.environ['ENV_JOB_NAME'] - tags = ' '.join(['{}={}'.format(key, value) - for key, value in tags.items()]) - template = 'az network vnet create --resource-group {} --name {} --tag ' + tags - self.live_only_execute(self.cli_ctx, template.format( - self.resource_group_name, name)) - - self.test_class_instance.kwargs[self.key] = name - return {self.parameter_name: name} - - def remove_resource(self, name): - # delete vnet if test is being recorded and if the vnet is not a dev rg - if not self.dev_setting_name: - self.live_only_execute( - self.cli_ctx, - 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) - - -# pylint: disable=too-many-instance-attributes -class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): - def __init__(self, name_prefix='clitest.vn', - parameter_name='subnet', - resource_group_name=None, - resource_group_key=KEY_RESOURCE_GROUP, - vnet_name=None, - vnet_key=KEY_VIRTUAL_NETWORK, - address_prefixes="11.0.0.0/24", - dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', - random_name_length=24, key=KEY_VNET_SUBNET): - if ' ' in name_prefix: - raise CliTestError( - 'Error: Space character in name prefix \'%s\'' % name_prefix) - super(VnetSubnetPreparer, self).__init__( - name_prefix, random_name_length) - self.cli_ctx = get_dummy_cli() - self.parameter_name = parameter_name - self.key = key - self.resource_group_name = resource_group_name - self.resource_group_key = resource_group_key - self.vnet_name = vnet_name - self.vnet_key = vnet_key - self.address_prefixes = address_prefixes - self.dev_setting_name = os.environ.get(dev_setting_name, None) - - def create_resource(self, name): - if self.dev_setting_name: - return {self.parameter_name: self.dev_setting_name, } - - if not self.resource_group_name: - self.resource_group_name = self.test_class_instance.kwargs.get( - self.resource_group_key) - if not self.resource_group_name: - raise CliTestError("Error: No resource group configured!") - if not self.vnet_name: - self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) - if not self.vnet_name: - raise CliTestError("Error: No vnet configured!") - - self.test_class_instance.kwargs[self.key] = 'default' - return {self.parameter_name: name} - - def remove_resource(self, name, **kwargs): - pass diff --git a/src/blockchain/azext_blockchain/tests/latest/test_blockchain_scenario.py b/src/blockchain/azext_blockchain/tests/latest/test_blockchain_scenario.py index 8bf09776ab4..4fee5f2a385 100644 --- a/src/blockchain/azext_blockchain/tests/latest/test_blockchain_scenario.py +++ b/src/blockchain/azext_blockchain/tests/latest/test_blockchain_scenario.py @@ -9,252 +9,122 @@ # -------------------------------------------------------------------------- import os -import unittest - -from azure_devtools.scenario_tests import AllowLargeResponse from azure.cli.testsdk import ScenarioTest -from .. import try_manual from azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_blockchain_member_operation_result_show +from .example_steps import step_blockchain_member_create +from .example_steps import step_blockchain_member_show +from .example_steps import step_blockchain_member_list +from .example_steps import step_blockchain_member_list_all +from .example_steps import step_blockchain_member_list_consortium_member +from .example_steps import step_blockchain_member_update +from .example_steps import step_blockchain_member_list_api_key +from .example_steps import step_blockchain_member_regenerate_api_key +from .example_steps import step_blockchain_member_delete +from .example_steps import step_consortium_list +from .example_steps import step_sku_list +from .example_steps import step_transaction_node_create +from .example_steps import step_transaction_node_show +from .example_steps import step_transaction_node_list +from .example_steps import step_transaction_node_update +from .example_steps import step_transaction_node_list_api_key +from .example_steps import step_transaction_node_regenerate_api_key +from .example_steps import step_transaction_node_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) +# Env setup_scenario @try_manual -def setup(test, rg): +def setup_scenario(test, rg): pass -# EXAMPLE: /Locations/post/Locations_ListConsortiums -@try_manual -def step__locations_post_locations_listconsortiums(test, rg): - test.cmd('az blockchain consortium list ' - '--location "{southeastasia}"', - checks=[ - test.check('length(value)', 0) - ]) - - -# EXAMPLE: /BlockchainMembers/put/BlockchainMembers_Create -@try_manual -def step__blockchainmembers_put_blockchainmembers_create(test, rg): - test.cmd('az blockchain member create ' - '--location "southeastasia" ' - '--consortium "ContoseConsortium" ' - '--consortium-management-account-password "1234abcdEFG1" ' - '--password "1234abcdEFG1" ' - '--validator-nodes-sku capacity=2 ' - '--protocol "Quorum" ' - '--name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--firewall-rules rule-name=mytest start-ip-address=10.0.0.0 end-ip-address=10.0.1.0 ' - '--no-wait', - checks=[]) - test.cmd('az blockchain member wait --created ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_List -@try_manual -def step__blockchainmembers_get_blockchainmembers_list(test, rg): - test.cmd('az blockchain member list ' - '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1) - ]) - - -# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_ListAll -@try_manual -def step__blockchainmembers_get_blockchainmembers_listall(test, rg): - test.cmd('az blockchain member list', - checks=[ - test.check('length(@)', 1) - ]) - - -# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_ListConsortiumMembers -@try_manual -def step__blockchainmembers_get_blockchainmembers_listconsortiummembers(test, rg): - test.cmd('az blockchain member list-consortium-member ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[ - test.check('length(@)', 1) - ]) - - -# EXAMPLE: /BlockchainMembers/post/BlockchainMembers_ListApiKeys -@try_manual -def step__blockchainmembers_post_blockchainmembers_listapikeys(test, rg): - test.cmd('az blockchain member list-api-key ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[ - test.check('length(keys)', 2) - ]) - - -# EXAMPLE: /BlockchainMembers/post/BlockchainMembers_ListRegenerateApiKeys -@try_manual -def step__blockchainmembers_post_blockchainmembers_listregenerateapikeys(test, rg): - test.cmd('az blockchain member regenerate-api-key ' - '--key-name "key1" ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[ - test.check('length(keys)', 2) - ]) - - -# EXAMPLE: /BlockchainMembers/patch/BlockchainMembers_Update -@try_manual -def step__blockchainmembers_patch_blockchainmembers_update(test, rg): - test.cmd('az blockchain member update ' - '--consortium-management-account-password "1234abcdEFG1" ' - '--password "1234abcdEFG1" ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /BlockchainMembers/get/BlockchainMembers_Get -@try_manual -def step__blockchainmembers_get_blockchainmembers_get(test, rg): - test.cmd('az blockchain member show ' - '--name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/put/TransactionNodes_Create -@try_manual -def step__transactionnodes_put_transactionnodes_create(test, rg): - test.cmd('az blockchain transaction-node create ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--location "southeastasia" ' - '--password "1234abcdEFG1" ' - '--name "{txnode2}" ' - '--no-wait', - checks=[]) - test.cmd('az blockchain transaction-node wait --created ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--name "{txnode2}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/get/TransactionNodes_List +# Env cleanup_scenario @try_manual -def step__transactionnodes_get_transactionnodes_list(test, rg): - test.cmd('az blockchain transaction-node list ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/post/TransactionNodes_ListApiKeys -@try_manual -def step__transactionnodes_post_transactionnodes_listapikeys(test, rg): - test.cmd('az blockchain transaction-node list-api-key ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--name "{txnode2}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/post/TransactionNodes_ListRegenerateApiKeys -@try_manual -def step__transactionnodes_post_transactionnodes_listregenerateapikeys(test, rg): - test.cmd('az blockchain transaction-node regenerate-api-key ' - '--key-name "key1" ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--name "{txnode2}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/patch/TransactionNodes_Update -@try_manual -def step__transactionnodes_patch_transactionnodes_update(test, rg): - test.cmd('az blockchain transaction-node update ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--password "1234abcdEFG1" ' - '--name "{txnode2}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/get/TransactionNodes_Get -@try_manual -def step__transactionnodes_get_transactionnodes_get(test, rg): - test.cmd('az blockchain transaction-node show ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--name "{txnode2}"', - checks=[]) - - -# EXAMPLE: /TransactionNodes/delete/TransactionNodes_Delete -@try_manual -def step__transactionnodes_delete_transactionnodes_delete(test, rg): - test.cmd('az blockchain transaction-node delete ' - '--member-name "{contosemember1}" ' - '--resource-group "{rg}" ' - '--name "{txnode2}" -y', - checks=[]) - - -# EXAMPLE: /BlockchainMembers/delete/BlockchainMembers_Delete -@try_manual -def step__blockchainmembers_delete_blockchainmembers_delete(test, rg): - test.cmd('az blockchain member delete ' - '--name "{contosemember1}" ' - '--resource-group "{rg}" -y', - checks=[]) - - -@try_manual -def cleanup(test, rg): +def cleanup_scenario(test, rg): pass +# Testcase: Scenario @try_manual def call_scenario(test, rg): - setup(test, rg) - step__locations_post_locations_listconsortiums(test, rg) - step__blockchainmembers_put_blockchainmembers_create(test, rg) - step__blockchainmembers_get_blockchainmembers_get(test, rg) - step__blockchainmembers_get_blockchainmembers_list(test, rg) - step__blockchainmembers_get_blockchainmembers_listall(test, rg) - step__blockchainmembers_get_blockchainmembers_listconsortiummembers(test, rg) - step__blockchainmembers_post_blockchainmembers_listapikeys(test, rg) - step__blockchainmembers_post_blockchainmembers_listregenerateapikeys(test, rg) - step__blockchainmembers_patch_blockchainmembers_update(test, rg) - step__transactionnodes_put_transactionnodes_create(test, rg) - step__transactionnodes_get_transactionnodes_list(test, rg) - step__transactionnodes_post_transactionnodes_listapikeys(test, rg) - step__transactionnodes_post_transactionnodes_listregenerateapikeys(test, rg) - step__transactionnodes_patch_transactionnodes_update(test, rg) - step__transactionnodes_get_transactionnodes_get(test, rg) - step__transactionnodes_delete_transactionnodes_delete(test, rg) - step__blockchainmembers_delete_blockchainmembers_delete(test, rg) - cleanup(test, rg) - - -@try_manual -class BlockchainManagementClientScenarioTest(ScenarioTest): - - @ResourceGroupPreparer(name_prefix='clitestblockchain_mygroup'[:7], key='rg', parameter_name='rg') - def test_blockchain(self, rg): - + setup_scenario(test, rg) + step_blockchain_member_operation_result_show(test, rg, checks=[]) + step_blockchain_member_create(test, rg, checks=[ + test.check("location", "{myLocation}", case_sensitive=False), + test.check("consortium", "ContoseConsortium", case_sensitive=False), + test.check("validatorNodesSku.capacity", 2), + test.check("protocol", "Quorum", case_sensitive=False), + test.check("name", "{myBlockchainMember}", case_sensitive=False), + ]) + step_blockchain_member_show(test, rg, checks=[ + test.check("location", "{myLocation}", case_sensitive=False), + test.check("consortium", "ContoseConsortium", case_sensitive=False), + test.check("validatorNodesSku.capacity", 2), + test.check("protocol", "Quorum", case_sensitive=False), + test.check("name", "{myBlockchainMember}", case_sensitive=False), + ]) + step_blockchain_member_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_blockchain_member_list_all(test, rg, checks=[]) + step_blockchain_member_list_consortium_member(test, rg, checks=[]) + step_blockchain_member_update(test, rg, checks=[ + test.check("name", "{myBlockchainMember2}", case_sensitive=False), + ]) + step_blockchain_member_list_api_key(test, rg, checks=[]) + step_blockchain_member_regenerate_api_key(test, rg, checks=[]) + step_blockchain_member_delete(test, rg, checks=[]) + step_consortium_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_sku_list(test, rg, checks=[]) + step_transaction_node_create(test, rg, checks=[ + test.check("location", "{myLocation}", case_sensitive=False), + test.check("name", "{myTransactionNode}", case_sensitive=False), + ]) + step_transaction_node_show(test, rg, checks=[ + test.check("location", "{myLocation}", case_sensitive=False), + test.check("name", "{myTransactionNode}", case_sensitive=False), + ]) + step_transaction_node_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_transaction_node_update(test, rg, checks=[ + test.check("location", "{myLocation}", case_sensitive=False), + test.check("name", "{myTransactionNode}", case_sensitive=False), + ]) + step_transaction_node_list_api_key(test, rg, checks=[]) + step_transaction_node_regenerate_api_key(test, rg, checks=[]) + step_transaction_node_delete(test, rg, checks=[]) + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class BlockchainScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(BlockchainScenarioTest, self).__init__(*args, **kwargs) self.kwargs.update({ - 'contosemember1': 'contosemember1', - 'southeastasia': 'southeastasia', - 'txnode2': 'txnode2', + 'myBlockchainMember': 'contosemember1', + 'myBlockchainMember2': 'ContoseMember1', + 'myLocation': 'southeastasia', + 'myTransactionNode': 'txnode2', + 'myTransactionNode2': 'txNode2', }) + + @ResourceGroupPreparer(name_prefix='clitestblockchain_mygroup'[:7], key='rg', parameter_name='rg') + def test_blockchain_Scenario(self, rg): call_scenario(self, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/__init__.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/__init__.py index edb3cabe580..0b7baef7b5f 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/__init__.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/__init__.py @@ -7,13 +7,10 @@ # -------------------------------------------------------------------------- from ._blockchain_management_client import BlockchainManagementClient -from ._version import VERSION - -__version__ = VERSION __all__ = ['BlockchainManagementClient'] try: - from .patch import patch_sdk + from ._patch import patch_sdk # type: ignore patch_sdk() except ImportError: pass diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_blockchain_management_client.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_blockchain_management_client.py index 1c8b5484d56..b9b81f6f536 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_blockchain_management_client.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_blockchain_management_client.py @@ -15,36 +15,39 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional + from azure.core.credentials import TokenCredential + from ._configuration import BlockchainManagementClientConfiguration -from .operations import BlockchainMemberOperations -from .operations import BlockchainMemberOperationResultOperations -from .operations import LocationOperations -from .operations import OperationOperations -from .operations import SkuOperations -from .operations import TransactionNodeOperations +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(object): """REST API for Azure Blockchain Service. - :ivar blockchain_member: BlockchainMemberOperations operations - :vartype blockchain_member: azure.mgmt.blockchain.operations.BlockchainMemberOperations - :ivar blockchain_member_operation_result: BlockchainMemberOperationResultOperations operations - :vartype blockchain_member_operation_result: azure.mgmt.blockchain.operations.BlockchainMemberOperationResultOperations - :ivar location: LocationOperations operations - :vartype location: azure.mgmt.blockchain.operations.LocationOperations - :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.blockchain.operations.OperationOperations - :ivar sku: SkuOperations operations - :vartype sku: azure.mgmt.blockchain.operations.SkuOperations - :ivar transaction_node: TransactionNodeOperations operations - :vartype transaction_node: azure.mgmt.blockchain.operations.TransactionNodeOperations + :ivar blockchain_members: BlockchainMembersOperations operations + :vartype blockchain_members: blockchain_management_client.operations.BlockchainMembersOperations + :ivar blockchain_member_operation_results: BlockchainMemberOperationResultsOperations operations + :vartype blockchain_member_operation_results: blockchain_management_client.operations.BlockchainMemberOperationResultsOperations + :ivar locations: LocationsOperations operations + :vartype locations: blockchain_management_client.operations.LocationsOperations + :ivar operations: Operations operations + :vartype operations: blockchain_management_client.operations.Operations + :ivar skus: SkusOperations operations + :vartype skus: blockchain_management_client.operations.SkusOperations + :ivar transaction_nodes: TransactionNodesOperations operations + :vartype transaction_nodes: blockchain_management_client.operations.TransactionNodesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -64,17 +67,17 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.blockchain_member = BlockchainMemberOperations( + self.blockchain_members = BlockchainMembersOperations( self._client, self._config, self._serialize, self._deserialize) - self.blockchain_member_operation_result = BlockchainMemberOperationResultOperations( + self.blockchain_member_operation_results = BlockchainMemberOperationResultsOperations( self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( + self.locations = LocationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.sku = SkuOperations( + self.skus = SkusOperations( self._client, self._config, self._serialize, self._deserialize) - self.transaction_node = TransactionNodeOperations( + self.transaction_nodes = TransactionNodesOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_configuration.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_configuration.py index 82d277156a8..c3ef56262f3 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_configuration.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_configuration.py @@ -10,8 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies - -from ._version import VERSION +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -19,6 +18,7 @@ from azure.core.credentials import TokenCredential +VERSION = "unknown" class BlockchainManagementClientConfiguration(Configuration): """Configuration for BlockchainManagementClient. @@ -48,8 +48,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-06-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-blockchain/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'blockchainmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -61,6 +61,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_version.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_version.py deleted file mode 100644 index 48944bf3938..00000000000 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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" diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/__init__.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/__init__.py index fa3459fe66a..1f9dd93ce78 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/__init__.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._blockchain_management_client_async import BlockchainManagementClient +from ._blockchain_management_client import BlockchainManagementClient __all__ = ['BlockchainManagementClient'] diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client.py similarity index 55% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client.py index c33e8b88da0..d9fd3425c53 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_blockchain_management_client.py @@ -6,41 +6,46 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -from ._configuration_async import BlockchainManagementClientConfiguration -from .operations_async import BlockchainMemberOperations -from .operations_async import BlockchainMemberOperationResultOperations -from .operations_async import LocationOperations -from .operations_async import OperationOperations -from .operations_async import SkuOperations -from .operations_async import TransactionNodeOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +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(object): """REST API for Azure Blockchain Service. - :ivar blockchain_member: BlockchainMemberOperations operations - :vartype blockchain_member: azure.mgmt.blockchain.aio.operations_async.BlockchainMemberOperations - :ivar blockchain_member_operation_result: BlockchainMemberOperationResultOperations operations - :vartype blockchain_member_operation_result: azure.mgmt.blockchain.aio.operations_async.BlockchainMemberOperationResultOperations - :ivar location: LocationOperations operations - :vartype location: azure.mgmt.blockchain.aio.operations_async.LocationOperations - :ivar operation: OperationOperations operations - :vartype operation: azure.mgmt.blockchain.aio.operations_async.OperationOperations - :ivar sku: SkuOperations operations - :vartype sku: azure.mgmt.blockchain.aio.operations_async.SkuOperations - :ivar transaction_node: TransactionNodeOperations operations - :vartype transaction_node: azure.mgmt.blockchain.aio.operations_async.TransactionNodeOperations + :ivar blockchain_members: BlockchainMembersOperations operations + :vartype blockchain_members: blockchain_management_client.aio.operations.BlockchainMembersOperations + :ivar blockchain_member_operation_results: BlockchainMemberOperationResultsOperations operations + :vartype blockchain_member_operation_results: blockchain_management_client.aio.operations.BlockchainMemberOperationResultsOperations + :ivar locations: LocationsOperations operations + :vartype locations: blockchain_management_client.aio.operations.LocationsOperations + :ivar operations: Operations operations + :vartype operations: blockchain_management_client.aio.operations.Operations + :ivar skus: SkusOperations operations + :vartype skus: blockchain_management_client.aio.operations.SkusOperations + :ivar transaction_nodes: TransactionNodesOperations operations + :vartype transaction_nodes: blockchain_management_client.aio.operations.TransactionNodesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -59,17 +64,17 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.blockchain_member = BlockchainMemberOperations( + self.blockchain_members = BlockchainMembersOperations( self._client, self._config, self._serialize, self._deserialize) - self.blockchain_member_operation_result = BlockchainMemberOperationResultOperations( + self.blockchain_member_operation_results = BlockchainMemberOperationResultsOperations( self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( + self.locations = LocationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) - self.sku = SkuOperations( + self.skus = SkusOperations( self._client, self._config, self._serialize, self._deserialize) - self.transaction_node = TransactionNodeOperations( + self.transaction_nodes = TransactionNodesOperations( self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration.py similarity index 86% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration.py index e8833e22e76..a91f9172711 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/_configuration.py @@ -10,13 +10,13 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies - -from .._version import VERSION +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential + from azure.core.credentials_async import AsyncTokenCredential +VERSION = "unknown" class BlockchainManagementClientConfiguration(Configuration): """Configuration for BlockchainManagementClient. @@ -45,8 +45,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2018-06-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - kwargs.setdefault('sdk_moniker', 'mgmt-blockchain/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'blockchainmanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -57,6 +57,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/__init__.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/__init__.py new file mode 100644 index 00000000000..f1e1a3d8f7b --- /dev/null +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# 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/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operation_result_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_member_operation_results_operations.py similarity index 77% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operation_result_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_member_operation_results_operations.py index f06e9831c28..ad68c6a4c15 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operation_result_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_member_operation_results_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,14 +18,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BlockchainMemberOperationResultOperations: - """BlockchainMemberOperationResultOperations async operations. +class BlockchainMemberOperationResultsOperations: + """BlockchainMemberOperationResultsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,7 +45,7 @@ async def get( location_name: str, operation_id: str, **kwargs - ) -> "models.OperationResult": + ) -> Optional["models.OperationResult"]: """Get Async operation result. :param location_name: Location name. @@ -53,16 +53,20 @@ async def get( :param operation_id: Operation Id. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResult or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.OperationResult or None + :return: OperationResult, or the result of cls(response) + :rtype: ~blockchain_management_client.models.OperationResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'locationName': self._serialize.url("location_name", location_name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), @@ -76,9 +80,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,7 +95,7 @@ async def get( deserialized = self._deserialize('OperationResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_members_operations.py similarity index 65% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_members_operations.py index c788c1b56e9..85e1e11aa41 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_blockchain_member_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_blockchain_members_operations.py @@ -5,14 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -21,14 +21,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BlockchainMemberOperations: - """BlockchainMemberOperations async operations. +class BlockchainMembersOperations: + """BlockchainMembersOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,16 +57,20 @@ async def get( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMember or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMember + :return: BlockchainMember, or the result of cls(response) + :rtype: ~blockchain_management_client.models.BlockchainMember :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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'), @@ -80,9 +84,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -94,37 +97,29 @@ async def get( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore async def _create_initial( self, blockchain_member_name: str, resource_group_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["models.Sku"] = None, - protocol: Optional[Union[str, "models.BlockchainProtocol"]] = None, - validator_nodes_sku: Optional["models.BlockchainMemberNodesSku"] = None, - password: Optional[str] = None, - consortium: Optional[str] = None, - consortium_management_account_password: Optional[str] = None, - consortium_role: Optional[str] = None, - consortium_member_display_name: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, + blockchain_member: Optional["models.BlockchainMember"] = None, **kwargs ) -> "models.BlockchainMember": cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _blockchain_member = models.BlockchainMember(location=location, tags=tags, sku=sku, protocol=protocol, validator_nodes_sku=validator_nodes_sku, password=password, consortium=consortium, consortium_management_account_password=consortium_management_account_password, consortium_role=consortium_role, consortium_member_display_name=consortium_member_display_name, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self._create_initial.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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'), @@ -139,17 +134,15 @@ async def _create_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _blockchain_member is not None: - body_content = self._serialize.body(_blockchain_member, 'BlockchainMember') + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMember') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -157,7 +150,6 @@ async def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('BlockchainMember', pipeline_response) @@ -165,87 +157,55 @@ async def _create_initial( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore - async def create( + async def begin_create( self, blockchain_member_name: str, resource_group_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["models.Sku"] = None, - protocol: Optional[Union[str, "models.BlockchainProtocol"]] = None, - validator_nodes_sku: Optional["models.BlockchainMemberNodesSku"] = None, - password: Optional[str] = None, - consortium: Optional[str] = None, - consortium_management_account_password: Optional[str] = None, - consortium_role: Optional[str] = None, - consortium_member_display_name: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, + blockchain_member: Optional["models.BlockchainMember"] = None, **kwargs - ) -> "models.BlockchainMember": + ) -> AsyncLROPoller["models.BlockchainMember"]: """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: 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 sku: Gets or sets the blockchain member Sku. - :type sku: ~azure.mgmt.blockchain.models.Sku - :param protocol: Gets or sets the blockchain protocol. - :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 - :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 - :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 - :param firewall_rules: Gets or sets firewall rules. - :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param blockchain_member: Payload to create a blockchain member. + :type blockchain_member: ~blockchain_management_client.models.BlockchainMember :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns BlockchainMember - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.blockchain.models.BlockchainMember] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BlockchainMember or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~blockchain_management_client.models.BlockchainMember] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - raw_result = await self._create_initial( - blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name, - location=location, - tags=tags, - sku=sku, - protocol=protocol, - validator_nodes_sku=validator_nodes_sku, - password=password, - consortium=consortium, - consortium_management_account_password=consortium_management_account_password, - consortium_role=consortium_role, - consortium_member_display_name=consortium_member_display_name, - firewall_rules=firewall_rules, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + blockchain_member=blockchain_member, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('BlockchainMember', pipeline_response) @@ -254,15 +214,25 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore async def _delete_initial( self, @@ -271,11 +241,14 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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'), @@ -290,7 +263,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,63 +272,80 @@ async def _delete_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore - async def delete( + async def begin_delete( self, blockchain_member_name: str, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - raw_result = await self._delete_initial( - blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore async def update( self, blockchain_member_name: str, resource_group_name: str, - tags: Optional[Dict[str, str]] = None, - password: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, - consortium_management_account_password: Optional[str] = None, + blockchain_member: Optional["models.BlockchainMemberUpdate"] = None, **kwargs ) -> "models.BlockchainMember": """Update a blockchain member. @@ -366,30 +355,24 @@ async def update( :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 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 + :param blockchain_member: Payload to update the blockchain member. + :type blockchain_member: ~blockchain_management_client.models.BlockchainMemberUpdate :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMember or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMember + :return: BlockchainMember, or the result of cls(response) + :rtype: ~blockchain_management_client.models.BlockchainMember :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _blockchain_member = models.BlockchainMemberUpdate(tags=tags, password=password, firewall_rules=firewall_rules, consortium_management_account_password=consortium_management_account_password) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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'), @@ -404,17 +387,15 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _blockchain_member is not None: - body_content = self._serialize.body(_blockchain_member, 'BlockchainMemberUpdate') + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMemberUpdate') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -425,52 +406,56 @@ async def update( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def list( self, resource_group_name: str, **kwargs - ) -> "models.BlockchainMemberCollection": + ) -> AsyncIterable["models.BlockchainMemberCollection"]: """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMemberCollection + :return: An iterator like instance of either BlockchainMemberCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blockchain_management_client.models.BlockchainMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -495,44 +480,48 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'} # type: ignore def list_all( self, **kwargs - ) -> "models.BlockchainMemberCollection": + ) -> AsyncIterable["models.BlockchainMemberCollection"]: """Lists the blockchain members for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMemberCollection + :return: An iterator like instance of either BlockchainMemberCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blockchain_management_client.models.BlockchainMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_all.metadata['url'] + url = self.list_all.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -557,53 +546,57 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'} + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'} # type: ignore - def list_consortium_member( + def list_consortium_members( self, blockchain_member_name: str, resource_group_name: str, **kwargs - ) -> "models.ConsortiumMemberCollection": + ) -> AsyncIterable["models.ConsortiumMemberCollection"]: """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConsortiumMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ConsortiumMemberCollection + :return: An iterator like instance of either ConsortiumMemberCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blockchain_management_client.models.ConsortiumMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConsortiumMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_consortium_member.metadata['url'] + url = self.list_consortium_members.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -628,9 +621,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_consortium_member.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'} + list_consortium_members.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'} # type: ignore - async def list_api_key( + async def list_api_keys( self, blockchain_member_name: str, resource_group_name: str, @@ -644,16 +637,20 @@ async def list_api_key( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_api_key.metadata['url'] + url = self.list_api_keys.metadata['url'] # type: ignore 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'), @@ -667,9 +664,8 @@ async def list_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -681,17 +677,16 @@ async def list_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'} + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'} # type: ignore - async def regenerate_api_key( + async def regenerate_api_keys( self, blockchain_member_name: str, resource_group_name: str, - key_name: Optional[str] = None, - value: Optional[str] = None, + api_key: Optional["models.ApiKey"] = None, **kwargs ) -> "models.ApiKeyCollection": """Regenerate the API keys for a blockchain member. @@ -701,24 +696,24 @@ async def regenerate_api_key( :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 api_key: api key to be regenerate. + :type api_key: ~blockchain_management_client.models.ApiKey :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _api_key = models.ApiKey(key_name=key_name, value=value) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_api_key.metadata['url'] + url = self.regenerate_api_keys.metadata['url'] # type: ignore 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'), @@ -733,17 +728,15 @@ async def regenerate_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _api_key is not None: - body_content = self._serialize.body(_api_key, 'ApiKey') + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -754,7 +747,7 @@ async def regenerate_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'} + regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_location_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_locations_operations.py similarity index 72% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_location_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_locations_operations.py index 01dd60ce40d..e2028439669 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_location_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_locations_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,14 +18,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LocationOperations: - """LocationOperations async operations. +class LocationsOperations: + """LocationsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,32 +43,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def check_name_availability( self, location_name: str, - name: Optional[str] = None, - type: Optional[str] = None, + name_availability_request: Optional["models.NameAvailabilityRequest"] = None, **kwargs ) -> "models.NameAvailability": """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 name_availability_request: Name availability request payload. + :type name_availability_request: ~blockchain_management_client.models.NameAvailabilityRequest :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.NameAvailability + :return: NameAvailability, or the result of cls(response) + :rtype: ~blockchain_management_client.models.NameAvailability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _name_availability_request = models.NameAvailabilityRequest(name=name, type=type) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore 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'), @@ -82,17 +81,15 @@ async def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _name_availability_request is not None: - body_content = self._serialize.body(_name_availability_request, 'NameAvailabilityRequest') + if name_availability_request is not None: + body_content = self._serialize.body(name_availability_request, 'NameAvailabilityRequest') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,12 +100,12 @@ async def check_name_availability( deserialized = self._deserialize('NameAvailability', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/checkNameAvailability'} # type: ignore - async def list_consortium( + async def list_consortiums( self, location_name: str, **kwargs @@ -118,16 +115,20 @@ async def list_consortium( :param location_name: Location Name. :type location_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConsortiumCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ConsortiumCollection + :return: ConsortiumCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ConsortiumCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConsortiumCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_consortium.metadata['url'] + url = self.list_consortiums.metadata['url'] # type: ignore 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'), @@ -140,9 +141,8 @@ async def list_consortium( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -154,7 +154,7 @@ async def list_consortium( deserialized = self._deserialize('ConsortiumCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_consortium.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums'} + list_consortiums.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_operation_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_operations.py similarity index 68% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_operation_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_operations.py index 9affee48ee7..42bbfdbf2da 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_operation_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_operations.py @@ -5,11 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -19,14 +19,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +class Operations: + """Operations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,35 +44,39 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "models.ResourceProviderOperationCollection": + ) -> AsyncIterable["models.ResourceProviderOperationCollection"]: """Lists the available operations of Microsoft.Blockchain resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceProviderOperationCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ResourceProviderOperationCollection + :return: An iterator like instance of either ResourceProviderOperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blockchain_management_client.models.ResourceProviderOperationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -97,4 +101,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Blockchain/operations'} + list.metadata = {'url': '/providers/Microsoft.Blockchain/operations'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_sku_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_skus_operations.py similarity index 78% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_sku_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_skus_operations.py index 0b265e39c61..c56aa7f0d69 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_sku_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_skus_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -18,14 +18,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SkuOperations: - """SkuOperations async operations. +class SkusOperations: + """SkusOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,16 +47,20 @@ async def list( """Lists the Skus of the resource type. :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceTypeSkuCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ResourceTypeSkuCollection + :return: ResourceTypeSkuCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ResourceTypeSkuCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceTypeSkuCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -68,9 +72,8 @@ async def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -82,7 +85,7 @@ async def list( deserialized = self._deserialize('ResourceTypeSkuCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_transaction_node_operations_async.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_transaction_nodes_operations.py similarity index 67% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_transaction_node_operations_async.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_transaction_nodes_operations.py index 7088ed91379..cca548a4de1 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/_transaction_node_operations_async.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations/_transaction_nodes_operations.py @@ -5,14 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -21,14 +21,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TransactionNodeOperations: - """TransactionNodeOperations async operations. +class TransactionNodesOperations: + """TransactionNodesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,16 +60,20 @@ async def get( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNode or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNode + :return: TransactionNode, or the result of cls(response) + :rtype: ~blockchain_management_client.models.TransactionNode :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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'), @@ -84,9 +88,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,30 +101,30 @@ async def get( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore async def _create_initial( self, blockchain_member_name: str, transaction_node_name: str, resource_group_name: str, - location: Optional[str] = None, - password: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, + transaction_node: Optional["models.TransactionNode"] = None, **kwargs ) -> "models.TransactionNode": cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _transaction_node = models.TransactionNode(location=location, password=password, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self._create_initial.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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'), @@ -137,17 +140,15 @@ async def _create_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _transaction_node is not None: - body_content = self._serialize.body(_transaction_node, 'TransactionNode') + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNode') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -155,7 +156,6 @@ async def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TransactionNode', pipeline_response) @@ -163,21 +163,19 @@ async def _create_initial( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore - async def create( + async def begin_create( self, blockchain_member_name: str, transaction_node_name: str, resource_group_name: str, - location: Optional[str] = None, - password: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, + transaction_node: Optional["models.TransactionNode"] = None, **kwargs - ) -> "models.TransactionNode": + ) -> AsyncLROPoller["models.TransactionNode"]: """Create or update the transaction node. :param blockchain_member_name: Blockchain member name. @@ -185,35 +183,39 @@ async def create( :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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param location: Gets or sets the transaction node location. - :type location: 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 transaction_node: Payload to create the transaction node. + :type transaction_node: ~blockchain_management_client.models.TransactionNode :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns TransactionNode - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.blockchain.models.TransactionNode] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either TransactionNode or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~blockchain_management_client.models.TransactionNode] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - raw_result = await self._create_initial( - blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name, - location=location, - password=password, - firewall_rules=firewall_rules, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('TransactionNode', pipeline_response) @@ -222,15 +224,26 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore async def _delete_initial( self, @@ -240,11 +253,14 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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'), @@ -260,7 +276,6 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -270,17 +285,17 @@ async def _delete_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore - async def delete( + async def begin_delete( self, blockchain_member_name: str, transaction_node_name: str, resource_group_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Delete the transaction node. :param blockchain_member_name: Blockchain member name. @@ -288,48 +303,68 @@ async def delete( :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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - raw_result = await self._delete_initial( - blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore async def update( self, blockchain_member_name: str, transaction_node_name: str, resource_group_name: str, - password: Optional[str] = None, - firewall_rules: Optional[List["FirewallRule"]] = None, + transaction_node: Optional["models.TransactionNodeUpdate"] = None, **kwargs ) -> "models.TransactionNode": """Update the transaction node. @@ -341,24 +376,24 @@ async def update( :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 transaction_node: Payload to create the transaction node. + :type transaction_node: ~blockchain_management_client.models.TransactionNodeUpdate :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNode or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNode + :return: TransactionNode, or the result of cls(response) + :rtype: ~blockchain_management_client.models.TransactionNode :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _transaction_node = models.TransactionNodeUpdate(password=password, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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'), @@ -374,17 +409,15 @@ async def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _transaction_node is not None: - body_content = self._serialize.body(_transaction_node, 'TransactionNodeUpdate') + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNodeUpdate') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -395,56 +428,60 @@ async def update( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def list( self, blockchain_member_name: str, resource_group_name: str, **kwargs - ) -> "models.TransactionNodeCollection": + ) -> AsyncIterable["models.TransactionNodeCollection"]: """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNodeCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNodeCollection + :return: An iterator like instance of either TransactionNodeCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~blockchain_management_client.models.TransactionNodeCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNodeCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -469,9 +506,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'} # type: ignore - async def list_api_key( + async def list_api_keys( self, blockchain_member_name: str, transaction_node_name: str, @@ -488,16 +525,20 @@ async def list_api_key( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_api_key.metadata['url'] + url = self.list_api_keys.metadata['url'] # type: ignore 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'), @@ -512,9 +553,8 @@ async def list_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -526,18 +566,17 @@ async def list_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'} + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'} # type: ignore - async def regenerate_api_key( + async def regenerate_api_keys( self, blockchain_member_name: str, transaction_node_name: str, resource_group_name: str, - key_name: Optional[str] = None, - value: Optional[str] = None, + api_key: Optional["models.ApiKey"] = None, **kwargs ) -> "models.ApiKeyCollection": """Regenerate the API keys for the blockchain member. @@ -549,24 +588,24 @@ async def regenerate_api_key( :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 api_key: api key to be regenerated. + :type api_key: ~blockchain_management_client.models.ApiKey :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _api_key = models.ApiKey(key_name=key_name, value=value) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_api_key.metadata['url'] + url = self.regenerate_api_keys.metadata['url'] # type: ignore 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'), @@ -582,17 +621,15 @@ async def regenerate_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _api_key is not None: - body_content = self._serialize.body(_api_key, 'ApiKey') + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -603,7 +640,7 @@ async def regenerate_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'} + regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/__init__.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/__init__.py deleted file mode 100644 index 7d6bd7e4f2b..00000000000 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/aio/operations_async/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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_member_operations_async import BlockchainMemberOperations -from ._blockchain_member_operation_result_operations_async import BlockchainMemberOperationResultOperations -from ._location_operations_async import LocationOperations -from ._operation_operations_async import OperationOperations -from ._sku_operations_async import SkuOperations -from ._transaction_node_operations_async import TransactionNodeOperations - -__all__ = [ - 'BlockchainMemberOperations', - 'BlockchainMemberOperationResultOperations', - 'LocationOperations', - 'OperationOperations', - 'SkuOperations', - 'TransactionNodeOperations', -] diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_blockchain_management_client_enums.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_blockchain_management_client_enums.py index 7abc7566c60..22d783b94ec 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_blockchain_management_client_enums.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_blockchain_management_client_enums.py @@ -6,42 +6,60 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass -class BlockchainMemberProvisioningState(str, Enum): +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class BlockchainMemberProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the blockchain member provision state. """ - not_specified = "NotSpecified" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - failed = "Failed" - stale = "Stale" + NOT_SPECIFIED = "NotSpecified" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + STALE = "Stale" -class BlockchainProtocol(str, Enum): +class BlockchainProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the blockchain protocol. """ - not_specified = "NotSpecified" - parity = "Parity" - quorum = "Quorum" - corda = "Corda" + NOT_SPECIFIED = "NotSpecified" + PARITY = "Parity" + QUORUM = "Quorum" + CORDA = "Corda" -class NameAvailabilityReason(str, Enum): +class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the name availability reason. """ - not_specified = "NotSpecified" - already_exists = "AlreadyExists" - invalid = "Invalid" + NOT_SPECIFIED = "NotSpecified" + ALREADY_EXISTS = "AlreadyExists" + INVALID = "Invalid" -class NodeProvisioningState(str, Enum): +class NodeProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the blockchain member provision state. """ - not_specified = "NotSpecified" - updating = "Updating" - deleting = "Deleting" - succeeded = "Succeeded" - failed = "Failed" + NOT_SPECIFIED = "NotSpecified" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models.py index 09703cd1371..cfe63873a57 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models.py @@ -36,7 +36,7 @@ class ApiKeyCollection(msrest.serialization.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] + :type keys: list[~blockchain_management_client.models.ApiKey] """ _attribute_map = { @@ -144,16 +144,16 @@ class BlockchainMember(TrackedResource): describes the resource. :type tags: dict[str, str] :param sku: Gets or sets the blockchain member Sku. - :type sku: ~azure.mgmt.blockchain.models.Sku + :type sku: ~blockchain_management_client.models.Sku :param protocol: Gets or sets the blockchain protocol. Possible values include: "NotSpecified", "Parity", "Quorum", "Corda". - :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + :type protocol: str or ~blockchain_management_client.models.BlockchainProtocol :param validator_nodes_sku: Gets or sets the blockchain validator nodes Sku. - :type validator_nodes_sku: ~azure.mgmt.blockchain.models.BlockchainMemberNodesSku + :type validator_nodes_sku: ~blockchain_management_client.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 + ~blockchain_management_client.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. @@ -177,7 +177,7 @@ class BlockchainMember(TrackedResource): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _validation = { @@ -241,7 +241,7 @@ class BlockchainMemberCollection(msrest.serialization.Model): """Collection of the blockchain member payload which is exposed in the request/response of the resource provider. :param value: Gets or sets the collection of blockchain members. - :type value: list[~azure.mgmt.blockchain.models.BlockchainMember] + :type value: list[~blockchain_management_client.models.BlockchainMember] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -287,7 +287,7 @@ class TransactionNodePropertiesUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _attribute_map = { @@ -310,7 +310,7 @@ class BlockchainMemberPropertiesUpdate(TransactionNodePropertiesUpdate): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] :param consortium_management_account_password: Sets the managed consortium management account password. :type consortium_management_account_password: str @@ -339,7 +339,7 @@ class BlockchainMemberUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] :param consortium_management_account_password: Sets the managed consortium management account password. :type consortium_management_account_password: str @@ -370,7 +370,7 @@ class Consortium(msrest.serialization.Model): :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 + :type protocol: str or ~blockchain_management_client.models.BlockchainProtocol """ _attribute_map = { @@ -391,7 +391,7 @@ class ConsortiumCollection(msrest.serialization.Model): """Collection of the consortium payload. :param value: Gets or sets the collection of consortiums. - :type value: list[~azure.mgmt.blockchain.models.Consortium] + :type value: list[~blockchain_management_client.models.Consortium] """ _attribute_map = { @@ -453,7 +453,7 @@ class ConsortiumMemberCollection(msrest.serialization.Model): """Collection of consortium payload. :param value: Gets or sets the collection of consortiums. - :type value: list[~azure.mgmt.blockchain.models.ConsortiumMember] + :type value: list[~blockchain_management_client.models.ConsortiumMember] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -510,7 +510,7 @@ class NameAvailability(msrest.serialization.Model): :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 + :type reason: str or ~blockchain_management_client.models.NameAvailabilityReason """ _attribute_map = { @@ -590,7 +590,7 @@ class ResourceProviderOperation(msrest.serialization.Model): or not. :type is_data_action: bool :param display: Gets or sets operation display. - :type display: ~azure.mgmt.blockchain.models.ResourceProviderOperationDisplay + :type display: ~blockchain_management_client.models.ResourceProviderOperationDisplay """ _attribute_map = { @@ -615,7 +615,7 @@ class ResourceProviderOperationCollection(msrest.serialization.Model): """Collection of operation payload which is exposed in the response of the resource provider. :param value: Gets or sets the collection of operations. - :type value: list[~azure.mgmt.blockchain.models.ResourceProviderOperation] + :type value: list[~blockchain_management_client.models.ResourceProviderOperation] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -673,7 +673,7 @@ class ResourceTypeSku(msrest.serialization.Model): :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] + :type skus: list[~blockchain_management_client.models.SkuSetting] """ _attribute_map = { @@ -694,7 +694,7 @@ class ResourceTypeSkuCollection(msrest.serialization.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] + :type value: list[~blockchain_management_client.models.ResourceTypeSku] """ _attribute_map = { @@ -778,7 +778,7 @@ class TransactionNode(Resource): :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 + :vartype provisioning_state: str or ~blockchain_management_client.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. @@ -788,7 +788,7 @@ class TransactionNode(Resource): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _validation = { @@ -832,7 +832,7 @@ class TransactionNodeCollection(msrest.serialization.Model): """Collection of transaction node payload which is exposed in the request/response of the resource provider. :param value: Gets or sets the collection of transaction nodes. - :type value: list[~azure.mgmt.blockchain.models.TransactionNode] + :type value: list[~blockchain_management_client.models.TransactionNode] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -859,7 +859,7 @@ class TransactionNodeUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _attribute_map = { diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models_py3.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models_py3.py index 2d768063b19..a2424fb3e07 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models_py3.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/models/_models_py3.py @@ -11,6 +11,8 @@ import msrest.serialization +from ._blockchain_management_client_enums import * + class ApiKey(msrest.serialization.Model): """API key payload which is exposed in the request/response of the resource provider. @@ -42,7 +44,7 @@ class ApiKeyCollection(msrest.serialization.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] + :type keys: list[~blockchain_management_client.models.ApiKey] """ _attribute_map = { @@ -155,16 +157,16 @@ class BlockchainMember(TrackedResource): describes the resource. :type tags: dict[str, str] :param sku: Gets or sets the blockchain member Sku. - :type sku: ~azure.mgmt.blockchain.models.Sku + :type sku: ~blockchain_management_client.models.Sku :param protocol: Gets or sets the blockchain protocol. Possible values include: "NotSpecified", "Parity", "Quorum", "Corda". - :type protocol: str or ~azure.mgmt.blockchain.models.BlockchainProtocol + :type protocol: str or ~blockchain_management_client.models.BlockchainProtocol :param validator_nodes_sku: Gets or sets the blockchain validator nodes Sku. - :type validator_nodes_sku: ~azure.mgmt.blockchain.models.BlockchainMemberNodesSku + :type validator_nodes_sku: ~blockchain_management_client.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 + ~blockchain_management_client.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. @@ -188,7 +190,7 @@ class BlockchainMember(TrackedResource): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _validation = { @@ -264,7 +266,7 @@ class BlockchainMemberCollection(msrest.serialization.Model): """Collection of the blockchain member payload which is exposed in the request/response of the resource provider. :param value: Gets or sets the collection of blockchain members. - :type value: list[~azure.mgmt.blockchain.models.BlockchainMember] + :type value: list[~blockchain_management_client.models.BlockchainMember] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -315,7 +317,7 @@ class TransactionNodePropertiesUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _attribute_map = { @@ -341,7 +343,7 @@ class BlockchainMemberPropertiesUpdate(TransactionNodePropertiesUpdate): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] :param consortium_management_account_password: Sets the managed consortium management account password. :type consortium_management_account_password: str @@ -374,7 +376,7 @@ class BlockchainMemberUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] :param consortium_management_account_password: Sets the managed consortium management account password. :type consortium_management_account_password: str @@ -410,7 +412,7 @@ class Consortium(msrest.serialization.Model): :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 + :type protocol: str or ~blockchain_management_client.models.BlockchainProtocol """ _attribute_map = { @@ -434,7 +436,7 @@ class ConsortiumCollection(msrest.serialization.Model): """Collection of the consortium payload. :param value: Gets or sets the collection of consortiums. - :type value: list[~azure.mgmt.blockchain.models.Consortium] + :type value: list[~blockchain_management_client.models.Consortium] """ _attribute_map = { @@ -506,7 +508,7 @@ class ConsortiumMemberCollection(msrest.serialization.Model): """Collection of consortium payload. :param value: Gets or sets the collection of consortiums. - :type value: list[~azure.mgmt.blockchain.models.ConsortiumMember] + :type value: list[~blockchain_management_client.models.ConsortiumMember] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -570,7 +572,7 @@ class NameAvailability(msrest.serialization.Model): :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 + :type reason: str or ~blockchain_management_client.models.NameAvailabilityReason """ _attribute_map = { @@ -661,7 +663,7 @@ class ResourceProviderOperation(msrest.serialization.Model): or not. :type is_data_action: bool :param display: Gets or sets operation display. - :type display: ~azure.mgmt.blockchain.models.ResourceProviderOperationDisplay + :type display: ~blockchain_management_client.models.ResourceProviderOperationDisplay """ _attribute_map = { @@ -691,7 +693,7 @@ class ResourceProviderOperationCollection(msrest.serialization.Model): """Collection of operation payload which is exposed in the response of the resource provider. :param value: Gets or sets the collection of operations. - :type value: list[~azure.mgmt.blockchain.models.ResourceProviderOperation] + :type value: list[~blockchain_management_client.models.ResourceProviderOperation] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -757,7 +759,7 @@ class ResourceTypeSku(msrest.serialization.Model): :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] + :type skus: list[~blockchain_management_client.models.SkuSetting] """ _attribute_map = { @@ -781,7 +783,7 @@ class ResourceTypeSkuCollection(msrest.serialization.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] + :type value: list[~blockchain_management_client.models.ResourceTypeSku] """ _attribute_map = { @@ -875,7 +877,7 @@ class TransactionNode(Resource): :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 + :vartype provisioning_state: str or ~blockchain_management_client.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. @@ -885,7 +887,7 @@ class TransactionNode(Resource): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _validation = { @@ -933,7 +935,7 @@ class TransactionNodeCollection(msrest.serialization.Model): """Collection of transaction node payload which is exposed in the request/response of the resource provider. :param value: Gets or sets the collection of transaction nodes. - :type value: list[~azure.mgmt.blockchain.models.TransactionNode] + :type value: list[~blockchain_management_client.models.TransactionNode] :param next_link: Gets or sets the URL, that the client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -963,7 +965,7 @@ class TransactionNodeUpdate(msrest.serialization.Model): :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] + :type firewall_rules: list[~blockchain_management_client.models.FirewallRule] """ _attribute_map = { diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/__init__.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/__init__.py index fa477a79c84..f1e1a3d8f7b 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/__init__.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/__init__.py @@ -6,18 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._blockchain_member_operations import BlockchainMemberOperations -from ._blockchain_member_operation_result_operations import BlockchainMemberOperationResultOperations -from ._location_operations import LocationOperations -from ._operation_operations import OperationOperations -from ._sku_operations import SkuOperations -from ._transaction_node_operations import TransactionNodeOperations +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__ = [ - 'BlockchainMemberOperations', - 'BlockchainMemberOperationResultOperations', - 'LocationOperations', - 'OperationOperations', - 'SkuOperations', - 'TransactionNodeOperations', + 'BlockchainMembersOperations', + 'BlockchainMemberOperationResultsOperations', + 'LocationsOperations', + 'Operations', + 'SkusOperations', + 'TransactionNodesOperations', ] diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_result_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_results_operations.py similarity index 77% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_result_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_results_operations.py index 187d8b4b298..9c056db8146 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_result_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operation_results_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -22,14 +22,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class BlockchainMemberOperationResultOperations(object): - """BlockchainMemberOperationResultOperations operations. +class BlockchainMemberOperationResultsOperations(object): + """BlockchainMemberOperationResultsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,7 +50,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.OperationResult" + # type: (...) -> Optional["models.OperationResult"] """Get Async operation result. :param location_name: Location name. @@ -58,16 +58,20 @@ def get( :param operation_id: Operation Id. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResult or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.OperationResult or None + :return: OperationResult, or the result of cls(response) + :rtype: ~blockchain_management_client.models.OperationResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'locationName': self._serialize.url("location_name", location_name, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str'), @@ -81,9 +85,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,7 +100,7 @@ def get( deserialized = self._deserialize('OperationResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_members_operations.py similarity index 66% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_members_operations.py index f88ae2efddb..ab4e27ae487 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_member_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_blockchain_members_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -20,19 +20,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class BlockchainMemberOperations(object): - """BlockchainMemberOperations operations. +class BlockchainMembersOperations(object): + """BlockchainMembersOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,16 +62,20 @@ def get( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMember or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMember + :return: BlockchainMember, or the result of cls(response) + :rtype: ~blockchain_management_client.models.BlockchainMember :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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'), @@ -85,9 +89,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,38 +102,30 @@ def get( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def _create_initial( self, blockchain_member_name, # type: str resource_group_name, # type: str - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - sku=None, # type: Optional["models.Sku"] - protocol=None, # type: Optional[Union[str, "models.BlockchainProtocol"]] - validator_nodes_sku=None, # type: Optional["models.BlockchainMemberNodesSku"] - password=None, # type: Optional[str] - consortium=None, # type: Optional[str] - consortium_management_account_password=None, # type: Optional[str] - consortium_role=None, # type: Optional[str] - consortium_member_display_name=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] + blockchain_member=None, # type: Optional["models.BlockchainMember"] **kwargs # type: Any ): # type: (...) -> "models.BlockchainMember" cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _blockchain_member = models.BlockchainMember(location=location, tags=tags, sku=sku, protocol=protocol, validator_nodes_sku=validator_nodes_sku, password=password, consortium=consortium, consortium_management_account_password=consortium_management_account_password, consortium_role=consortium_role, consortium_member_display_name=consortium_member_display_name, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self._create_initial.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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'), @@ -145,17 +140,15 @@ def _create_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _blockchain_member is not None: - body_content = self._serialize.body(_blockchain_member, 'BlockchainMember') + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMember') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,7 +156,6 @@ def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('BlockchainMember', pipeline_response) @@ -171,88 +163,56 @@ def _create_initial( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def begin_create( self, blockchain_member_name, # type: str resource_group_name, # type: str - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - sku=None, # type: Optional["models.Sku"] - protocol=None, # type: Optional[Union[str, "models.BlockchainProtocol"]] - validator_nodes_sku=None, # type: Optional["models.BlockchainMemberNodesSku"] - password=None, # type: Optional[str] - consortium=None, # type: Optional[str] - consortium_management_account_password=None, # type: Optional[str] - consortium_role=None, # type: Optional[str] - consortium_member_display_name=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] + blockchain_member=None, # type: Optional["models.BlockchainMember"] **kwargs # type: Any ): - # type: (...) -> "models.BlockchainMember" + # type: (...) -> LROPoller["models.BlockchainMember"] """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: 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 sku: Gets or sets the blockchain member Sku. - :type sku: ~azure.mgmt.blockchain.models.Sku - :param protocol: Gets or sets the blockchain protocol. - :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 - :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 - :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 - :param firewall_rules: Gets or sets firewall rules. - :type firewall_rules: list[~azure.mgmt.blockchain.models.FirewallRule] + :param blockchain_member: Payload to create a blockchain member. + :type blockchain_member: ~blockchain_management_client.models.BlockchainMember :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns BlockchainMember - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.blockchain.models.BlockchainMember] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BlockchainMember or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~blockchain_management_client.models.BlockchainMember] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - raw_result = self._create_initial( - blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name, - location=location, - tags=tags, - sku=sku, - protocol=protocol, - validator_nodes_sku=validator_nodes_sku, - password=password, - consortium=consortium, - consortium_management_account_password=consortium_management_account_password, - consortium_role=consortium_role, - consortium_member_display_name=consortium_member_display_name, - firewall_rules=firewall_rules, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + blockchain_member=blockchain_member, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('BlockchainMember', pipeline_response) @@ -261,15 +221,25 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def _delete_initial( self, @@ -279,11 +249,14 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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'), @@ -298,7 +271,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,9 +280,9 @@ def _delete_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def begin_delete( self, @@ -318,54 +290,71 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller[None] """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - raw_result = self._delete_initial( - blockchain_member_name=blockchain_member_name, - resource_group_name=resource_group_name, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + blockchain_member_name=blockchain_member_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def update( self, blockchain_member_name, # type: str resource_group_name, # type: str - tags=None, # type: Optional[Dict[str, str]] - password=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] - consortium_management_account_password=None, # type: Optional[str] + blockchain_member=None, # type: Optional["models.BlockchainMemberUpdate"] **kwargs # type: Any ): # type: (...) -> "models.BlockchainMember" @@ -376,30 +365,24 @@ def update( :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 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 + :param blockchain_member: Payload to update the blockchain member. + :type blockchain_member: ~blockchain_management_client.models.BlockchainMemberUpdate :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMember or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMember + :return: BlockchainMember, or the result of cls(response) + :rtype: ~blockchain_management_client.models.BlockchainMember :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMember"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _blockchain_member = models.BlockchainMemberUpdate(tags=tags, password=password, firewall_rules=firewall_rules, consortium_management_account_password=consortium_management_account_password) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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'), @@ -414,17 +397,15 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _blockchain_member is not None: - body_content = self._serialize.body(_blockchain_member, 'BlockchainMemberUpdate') + if blockchain_member is not None: + body_content = self._serialize.body(blockchain_member, 'BlockchainMemberUpdate') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -435,53 +416,57 @@ def update( deserialized = self._deserialize('BlockchainMember', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'} # type: ignore def list( self, resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.BlockchainMemberCollection" + # type: (...) -> Iterable["models.BlockchainMemberCollection"] """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMemberCollection + :return: An iterator like instance of either BlockchainMemberCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blockchain_management_client.models.BlockchainMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -506,45 +491,49 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'} # type: ignore def list_all( self, **kwargs # type: Any ): - # type: (...) -> "models.BlockchainMemberCollection" + # type: (...) -> Iterable["models.BlockchainMemberCollection"] """Lists the blockchain members for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: BlockchainMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.BlockchainMemberCollection + :return: An iterator like instance of either BlockchainMemberCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blockchain_management_client.models.BlockchainMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.BlockchainMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_all.metadata['url'] + url = self.list_all.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -569,54 +558,58 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'} + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'} # type: ignore - def list_consortium_member( + def list_consortium_members( self, blockchain_member_name, # type: str resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ConsortiumMemberCollection" + # type: (...) -> Iterable["models.ConsortiumMemberCollection"] """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConsortiumMemberCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ConsortiumMemberCollection + :return: An iterator like instance of either ConsortiumMemberCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blockchain_management_client.models.ConsortiumMemberCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConsortiumMemberCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_consortium_member.metadata['url'] + url = self.list_consortium_members.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -641,9 +634,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_consortium_member.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'} + list_consortium_members.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'} # type: ignore - def list_api_key( + def list_api_keys( self, blockchain_member_name, # type: str resource_group_name, # type: str @@ -658,16 +651,20 @@ def list_api_key( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_api_key.metadata['url'] + url = self.list_api_keys.metadata['url'] # type: ignore 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'), @@ -681,9 +678,8 @@ def list_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -695,17 +691,16 @@ def list_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'} + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'} # type: ignore - def regenerate_api_key( + def regenerate_api_keys( self, blockchain_member_name, # type: str resource_group_name, # type: str - key_name=None, # type: Optional[str] - value=None, # type: Optional[str] + api_key=None, # type: Optional["models.ApiKey"] **kwargs # type: Any ): # type: (...) -> "models.ApiKeyCollection" @@ -716,24 +711,24 @@ def regenerate_api_key( :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 api_key: api key to be regenerate. + :type api_key: ~blockchain_management_client.models.ApiKey :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _api_key = models.ApiKey(key_name=key_name, value=value) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_api_key.metadata['url'] + url = self.regenerate_api_keys.metadata['url'] # type: ignore 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'), @@ -748,17 +743,15 @@ def regenerate_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _api_key is not None: - body_content = self._serialize.body(_api_key, 'ApiKey') + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -769,7 +762,7 @@ def regenerate_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'} + regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_location_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_locations_operations.py similarity index 73% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_location_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_locations_operations.py index 56bbd566c9b..c101e729f64 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_location_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_locations_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -22,14 +22,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class LocationOperations(object): - """LocationOperations operations. +class LocationsOperations(object): + """LocationsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,8 +47,7 @@ def __init__(self, client, config, serializer, deserializer): def check_name_availability( self, location_name, # type: str - name=None, # type: Optional[str] - type=None, # type: Optional[str] + name_availability_request=None, # type: Optional["models.NameAvailabilityRequest"] **kwargs # type: Any ): # type: (...) -> "models.NameAvailability" @@ -56,24 +55,24 @@ def check_name_availability( :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 name_availability_request: Name availability request payload. + :type name_availability_request: ~blockchain_management_client.models.NameAvailabilityRequest :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.NameAvailability + :return: NameAvailability, or the result of cls(response) + :rtype: ~blockchain_management_client.models.NameAvailability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _name_availability_request = models.NameAvailabilityRequest(name=name, type=type) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore 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'), @@ -87,17 +86,15 @@ def check_name_availability( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _name_availability_request is not None: - body_content = self._serialize.body(_name_availability_request, 'NameAvailabilityRequest') + if name_availability_request is not None: + body_content = self._serialize.body(name_availability_request, 'NameAvailabilityRequest') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,12 +105,12 @@ def check_name_availability( deserialized = self._deserialize('NameAvailability', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/checkNameAvailability'} # type: ignore - def list_consortium( + def list_consortiums( self, location_name, # type: str **kwargs # type: Any @@ -124,16 +121,20 @@ def list_consortium( :param location_name: Location Name. :type location_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConsortiumCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ConsortiumCollection + :return: ConsortiumCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ConsortiumCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ConsortiumCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_consortium.metadata['url'] + url = self.list_consortiums.metadata['url'] # type: ignore 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'), @@ -146,9 +147,8 @@ def list_consortium( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -160,7 +160,7 @@ def list_consortium( deserialized = self._deserialize('ConsortiumCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_consortium.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums'} + list_consortiums.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operation_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operations.py similarity index 69% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operation_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operations.py index d518724559e..a7571e1b13a 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operation_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -18,19 +18,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +class Operations(object): + """Operations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,35 +49,39 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.ResourceProviderOperationCollection" + # type: (...) -> Iterable["models.ResourceProviderOperationCollection"] """Lists the available operations of Microsoft.Blockchain resource provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceProviderOperationCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ResourceProviderOperationCollection + :return: An iterator like instance of either ResourceProviderOperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blockchain_management_client.models.ResourceProviderOperationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -102,4 +106,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Blockchain/operations'} + list.metadata = {'url': '/providers/Microsoft.Blockchain/operations'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_sku_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_skus_operations.py similarity index 78% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_sku_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_skus_operations.py index 36b46ed8556..36b63cfd989 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_sku_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_skus_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -22,14 +22,14 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class SkuOperations(object): - """SkuOperations operations. +class SkusOperations(object): + """SkusOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -52,16 +52,20 @@ def list( """Lists the Skus of the resource type. :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceTypeSkuCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ResourceTypeSkuCollection + :return: ResourceTypeSkuCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ResourceTypeSkuCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceTypeSkuCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -73,9 +77,8 @@ def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -87,7 +90,7 @@ def list( deserialized = self._deserialize('ResourceTypeSkuCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'} # type: ignore diff --git a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_node_operations.py b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_nodes_operations.py similarity index 68% rename from src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_node_operations.py rename to src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_nodes_operations.py index af93962b361..dbfde485ca2 100644 --- a/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_node_operations.py +++ b/src/blockchain/azext_blockchain/vendored_sdks/blockchain/operations/_transaction_nodes_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -20,19 +20,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class TransactionNodeOperations(object): - """TransactionNodeOperations operations. +class TransactionNodesOperations(object): + """TransactionNodesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.blockchain.models + :type models: ~blockchain_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -65,16 +65,20 @@ def get( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNode or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNode + :return: TransactionNode, or the result of cls(response) + :rtype: ~blockchain_management_client.models.TransactionNode :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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'), @@ -89,9 +93,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,31 +106,31 @@ def get( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def _create_initial( self, blockchain_member_name, # type: str transaction_node_name, # type: str resource_group_name, # type: str - location=None, # type: Optional[str] - password=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] + transaction_node=None, # type: Optional["models.TransactionNode"] **kwargs # type: Any ): # type: (...) -> "models.TransactionNode" cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _transaction_node = models.TransactionNode(location=location, password=password, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self._create_initial.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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'), @@ -143,17 +146,15 @@ def _create_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _transaction_node is not None: - body_content = self._serialize.body(_transaction_node, 'TransactionNode') + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNode') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -161,7 +162,6 @@ def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('TransactionNode', pipeline_response) @@ -169,22 +169,20 @@ def _create_initial( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def begin_create( self, blockchain_member_name, # type: str transaction_node_name, # type: str resource_group_name, # type: str - location=None, # type: Optional[str] - password=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] + transaction_node=None, # type: Optional["models.TransactionNode"] **kwargs # type: Any ): - # type: (...) -> "models.TransactionNode" + # type: (...) -> LROPoller["models.TransactionNode"] """Create or update the transaction node. :param blockchain_member_name: Blockchain member name. @@ -192,35 +190,39 @@ def begin_create( :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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param location: Gets or sets the transaction node location. - :type location: 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 transaction_node: Payload to create the transaction node. + :type transaction_node: ~blockchain_management_client.models.TransactionNode :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns TransactionNode - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.blockchain.models.TransactionNode] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either TransactionNode or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~blockchain_management_client.models.TransactionNode] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - raw_result = self._create_initial( - blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name, - location=location, - password=password, - firewall_rules=firewall_rules, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('TransactionNode', pipeline_response) @@ -229,15 +231,26 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def _delete_initial( self, @@ -248,11 +261,14 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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'), @@ -268,7 +284,6 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -278,9 +293,9 @@ def _delete_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def begin_delete( self, @@ -289,7 +304,7 @@ def begin_delete( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller[None] """Delete the transaction node. :param blockchain_member_name: Blockchain member name. @@ -297,48 +312,68 @@ def begin_delete( :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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] - raw_result = self._delete_initial( - blockchain_member_name=blockchain_member_name, - transaction_node_name=transaction_node_name, - resource_group_name=resource_group_name, - cls=lambda x,y,z: x, - **kwargs + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + blockchain_member_name=blockchain_member_name, + transaction_node_name=transaction_node_name, + resource_group_name=resource_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def update( self, blockchain_member_name, # type: str transaction_node_name, # type: str resource_group_name, # type: str - password=None, # type: Optional[str] - firewall_rules=None, # type: Optional[List["FirewallRule"]] + transaction_node=None, # type: Optional["models.TransactionNodeUpdate"] **kwargs # type: Any ): # type: (...) -> "models.TransactionNode" @@ -351,24 +386,24 @@ def update( :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 transaction_node: Payload to create the transaction node. + :type transaction_node: ~blockchain_management_client.models.TransactionNodeUpdate :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNode or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNode + :return: TransactionNode, or the result of cls(response) + :rtype: ~blockchain_management_client.models.TransactionNode :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNode"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _transaction_node = models.TransactionNodeUpdate(password=password, firewall_rules=firewall_rules) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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'), @@ -384,17 +419,15 @@ def update( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _transaction_node is not None: - body_content = self._serialize.body(_transaction_node, 'TransactionNodeUpdate') + if transaction_node is not None: + body_content = self._serialize.body(transaction_node, 'TransactionNodeUpdate') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -405,10 +438,10 @@ def update( deserialized = self._deserialize('TransactionNode', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'} # type: ignore def list( self, @@ -416,46 +449,50 @@ def list( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TransactionNodeCollection" + # type: (...) -> Iterable["models.TransactionNodeCollection"] """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. + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TransactionNodeCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.TransactionNodeCollection + :return: An iterator like instance of either TransactionNodeCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~blockchain_management_client.models.TransactionNodeCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TransactionNodeCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -480,9 +517,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'} # type: ignore - def list_api_key( + def list_api_keys( self, blockchain_member_name, # type: str transaction_node_name, # type: str @@ -500,16 +537,20 @@ def list_api_key( obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" + accept = "application/json" # Construct URL - url = self.list_api_key.metadata['url'] + url = self.list_api_keys.metadata['url'] # type: ignore 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'), @@ -524,9 +565,8 @@ def list_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -538,18 +578,17 @@ def list_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'} + list_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'} # type: ignore - def regenerate_api_key( + def regenerate_api_keys( self, blockchain_member_name, # type: str transaction_node_name, # type: str resource_group_name, # type: str - key_name=None, # type: Optional[str] - value=None, # type: Optional[str] + api_key=None, # type: Optional["models.ApiKey"] **kwargs # type: Any ): # type: (...) -> "models.ApiKeyCollection" @@ -562,24 +601,24 @@ def regenerate_api_key( :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 api_key: api key to be regenerated. + :type api_key: ~blockchain_management_client.models.ApiKey :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiKeyCollection or the result of cls(response) - :rtype: ~azure.mgmt.blockchain.models.ApiKeyCollection + :return: ApiKeyCollection, or the result of cls(response) + :rtype: ~blockchain_management_client.models.ApiKeyCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.ApiKeyCollection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) - - _api_key = models.ApiKey(key_name=key_name, value=value) + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-06-01-preview" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_api_key.metadata['url'] + url = self.regenerate_api_keys.metadata['url'] # type: ignore 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'), @@ -595,17 +634,15 @@ def regenerate_api_key( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - if _api_key is not None: - body_content = self._serialize.body(_api_key, 'ApiKey') + if api_key is not None: + body_content = self._serialize.body(api_key, 'ApiKey') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -616,7 +653,7 @@ def regenerate_api_key( deserialized = self._deserialize('ApiKeyCollection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_api_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'} + regenerate_api_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'} # type: ignore diff --git a/src/blockchain/report.md b/src/blockchain/report.md index e0c70a7675c..290bbc038ca 100644 --- a/src/blockchain/report.md +++ b/src/blockchain/report.md @@ -1,164 +1,325 @@ # Azure CLI Module Creation Report -### blockchain consortium list - -list a blockchain consortium. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--location-name**|string|Location Name.|location_name| -### blockchain member create - -create a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--location**|string|The GEO location of the blockchain service.|location| -|**--tags**|dictionary|Tags of the service which is a list of key value pairs that describes the resource.|tags| -|**--sku**|object|Gets or sets the blockchain member Sku.|sku| -|**--protocol**|choice|Gets or sets the blockchain protocol.|protocol| -|**--validator-nodes-sku**|object|Gets or sets the blockchain validator nodes Sku.|validator_nodes_sku| -|**--password**|string|Sets the basic auth password of the blockchain member.|password| -|**--consortium**|string|Gets or sets the consortium for the blockchain member.|consortium| -|**--consortium-management-account-password**|string|Sets the managed consortium management account password.|consortium_management_account_password| -|**--consortium-role**|string|Gets the role of the member in the consortium.|consortium_role| -|**--consortium-member-display-name**|string|Gets the display name of the member in the consortium.|consortium_member_display_name| -|**--firewall-rules**|array|Gets or sets firewall rules|firewall_rules| -### blockchain member delete - -delete a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain member list - -list a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain member list-all - -list-all a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -### blockchain member list-api-key - -list-api-key a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain member list-consortium-member - -list-consortium-member a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain member regenerate-api-key - -regenerate-api-key a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--key-name**|string|Gets or sets the API key name.|key_name| -|**--value**|string|Gets or sets the API key value.|value| -### blockchain member show - -show a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain member update - -update a blockchain member. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--tags**|dictionary|Tags of the service which is a list of key value pairs that describes the resource.|tags| -|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password| -|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules| -|**--consortium-management-account-password**|string|Sets the managed consortium management account password.|consortium_management_account_password| -### blockchain transaction-node create - -create a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--location**|string|Gets or sets the transaction node location.|location| -|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password| -|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules| -### blockchain transaction-node delete - -delete a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain transaction-node list - -list a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain transaction-node list-api-key - -list-api-key a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain transaction-node regenerate-api-key - -regenerate-api-key a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--key-name**|string|Gets or sets the API key name.|key_name| -|**--value**|string|Gets or sets the API key value.|value| -### blockchain transaction-node show - -show a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -### blockchain transaction-node update - -update a blockchain transaction-node. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name| -|**--transaction-node-name**|string|Transaction node name.|transaction_node_name| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name| -|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password| -|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules| \ No newline at end of file +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az blockchain|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az blockchain` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az blockchain blockchain-member|BlockchainMembers|[commands](#CommandsInBlockchainMembers)| +|az blockchain blockchain-member-operation-result|BlockchainMemberOperationResults|[commands](#CommandsInBlockchainMemberOperationResults)| +|az blockchain consortium|Locations|[commands](#CommandsInLocations)| +|az blockchain sku|Skus|[commands](#CommandsInSkus)| +|az blockchain transaction-node|TransactionNodes|[commands](#CommandsInTransactionNodes)| + +## COMMANDS +### Commands in `az blockchain blockchain-member` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az blockchain blockchain-member list](#BlockchainMembersList)|List|[Parameters](#ParametersBlockchainMembersList)|[Example](#ExamplesBlockchainMembersList)| +|[az blockchain blockchain-member show](#BlockchainMembersGet)|Get|[Parameters](#ParametersBlockchainMembersGet)|[Example](#ExamplesBlockchainMembersGet)| +|[az blockchain blockchain-member create](#BlockchainMembersCreate)|Create|[Parameters](#ParametersBlockchainMembersCreate)|[Example](#ExamplesBlockchainMembersCreate)| +|[az blockchain blockchain-member update](#BlockchainMembersUpdate)|Update|[Parameters](#ParametersBlockchainMembersUpdate)|[Example](#ExamplesBlockchainMembersUpdate)| +|[az blockchain blockchain-member delete](#BlockchainMembersDelete)|Delete|[Parameters](#ParametersBlockchainMembersDelete)|[Example](#ExamplesBlockchainMembersDelete)| +|[az blockchain blockchain-member list-all](#BlockchainMembersListAll)|ListAll|[Parameters](#ParametersBlockchainMembersListAll)|[Example](#ExamplesBlockchainMembersListAll)| +|[az blockchain blockchain-member list-api-key](#BlockchainMembersListApiKeys)|ListApiKeys|[Parameters](#ParametersBlockchainMembersListApiKeys)|[Example](#ExamplesBlockchainMembersListApiKeys)| +|[az blockchain blockchain-member list-consortium-member](#BlockchainMembersListConsortiumMembers)|ListConsortiumMembers|[Parameters](#ParametersBlockchainMembersListConsortiumMembers)|[Example](#ExamplesBlockchainMembersListConsortiumMembers)| +|[az blockchain blockchain-member regenerate-api-key](#BlockchainMembersRegenerateApiKeys)|RegenerateApiKeys|[Parameters](#ParametersBlockchainMembersRegenerateApiKeys)|[Example](#ExamplesBlockchainMembersRegenerateApiKeys)| + +### Commands in `az blockchain blockchain-member-operation-result` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az blockchain blockchain-member-operation-result show](#BlockchainMemberOperationResultsGet)|Get|[Parameters](#ParametersBlockchainMemberOperationResultsGet)|[Example](#ExamplesBlockchainMemberOperationResultsGet)| + +### Commands in `az blockchain consortium` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az blockchain consortium list](#LocationsListConsortiums)|ListConsortiums|[Parameters](#ParametersLocationsListConsortiums)|[Example](#ExamplesLocationsListConsortiums)| + +### Commands in `az blockchain sku` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az blockchain sku list](#SkusList)|List|[Parameters](#ParametersSkusList)|[Example](#ExamplesSkusList)| + +### Commands in `az blockchain transaction-node` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az blockchain transaction-node list](#TransactionNodesList)|List|[Parameters](#ParametersTransactionNodesList)|[Example](#ExamplesTransactionNodesList)| +|[az blockchain transaction-node show](#TransactionNodesGet)|Get|[Parameters](#ParametersTransactionNodesGet)|[Example](#ExamplesTransactionNodesGet)| +|[az blockchain transaction-node create](#TransactionNodesCreate)|Create|[Parameters](#ParametersTransactionNodesCreate)|[Example](#ExamplesTransactionNodesCreate)| +|[az blockchain transaction-node update](#TransactionNodesUpdate)|Update|[Parameters](#ParametersTransactionNodesUpdate)|[Example](#ExamplesTransactionNodesUpdate)| +|[az blockchain transaction-node delete](#TransactionNodesDelete)|Delete|[Parameters](#ParametersTransactionNodesDelete)|[Example](#ExamplesTransactionNodesDelete)| +|[az blockchain transaction-node list-api-key](#TransactionNodesListApiKeys)|ListApiKeys|[Parameters](#ParametersTransactionNodesListApiKeys)|[Example](#ExamplesTransactionNodesListApiKeys)| +|[az blockchain transaction-node regenerate-api-key](#TransactionNodesRegenerateApiKeys)|RegenerateApiKeys|[Parameters](#ParametersTransactionNodesRegenerateApiKeys)|[Example](#ExamplesTransactionNodesRegenerateApiKeys)| + + +## COMMAND DETAILS + +### group `az blockchain blockchain-member` +#### Command `az blockchain blockchain-member list` + +##### Example +``` +az blockchain blockchain-member list --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain blockchain-member show` + +##### Example +``` +az blockchain blockchain-member show --name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain blockchain-member create` + +##### Example +``` +az blockchain blockchain-member create --location "southeastasia" --consortium "ContoseConsortium" \ +--consortium-management-account-password "" --password "" --capacity 2 \ +--protocol "Quorum" --name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--location**|string|The GEO location of the blockchain service.|location|location| +|**--tags**|dictionary|Tags of the service which is a list of key value pairs that describes the resource.|tags|tags| +|**--sku**|object|Gets or sets the blockchain member Sku.|sku|sku| +|**--protocol**|choice|Gets or sets the blockchain protocol.|protocol|protocol| +|**--password**|string|Sets the basic auth password of the blockchain member.|password|password| +|**--consortium**|string|Gets or sets the consortium for the blockchain member.|consortium|consortium| +|**--consortium-management-account-password**|string|Sets the managed consortium management account password.|consortium_management_account_password|consortiumManagementAccountPassword| +|**--consortium-role**|string|Gets the role of the member in the consortium.|consortium_role|consortiumRole| +|**--consortium-member-display-name**|string|Gets the display name of the member in the consortium.|consortium_member_display_name|consortiumMemberDisplayName| +|**--firewall-rules**|array|Gets or sets firewall rules|firewall_rules|firewallRules| +|**--capacity**|integer|Gets or sets the nodes capacity.|capacity|capacity| + +#### Command `az blockchain blockchain-member update` + +##### Example +``` +az blockchain blockchain-member update --consortium-management-account-password ""\ + --password "" --name "ContoseMember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--tags**|dictionary|Tags of the service which is a list of key value pairs that describes the resource.|tags|tags| +|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password|password| +|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules|firewallRules| +|**--consortium-management-account-password**|string|Sets the managed consortium management account password.|consortium_management_account_password|consortiumManagementAccountPassword| + +#### Command `az blockchain blockchain-member delete` + +##### Example +``` +az blockchain blockchain-member delete --name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain blockchain-member list-all` + +##### Example +``` +az blockchain blockchain-member list-all +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az blockchain blockchain-member list-api-key` + +##### Example +``` +az blockchain blockchain-member list-api-key --name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain blockchain-member list-consortium-member` + +##### Example +``` +az blockchain blockchain-member list-consortium-member --name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain blockchain-member regenerate-api-key` + +##### Example +``` +az blockchain blockchain-member regenerate-api-key --key-name "key1" --name "contosemember1" --resource-group \ +"mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--key-name**|string|Gets or sets the API key name.|key_name|keyName| +|**--value**|string|Gets or sets the API key value.|value|value| + +### group `az blockchain blockchain-member-operation-result` +#### Command `az blockchain blockchain-member-operation-result show` + +##### Example +``` +az blockchain blockchain-member-operation-result show --operation-id "12f4b309-01e3-4fcf-bc0b-1cc034ca03f8" \ +--location-name "southeastasia" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--location-name**|string|Location name.|location_name|locationName| +|**--operation-id**|string|Operation Id.|operation_id|operationId| + +### group `az blockchain consortium` +#### Command `az blockchain consortium list` + +##### Example +``` +az blockchain consortium list --name "southeastasia" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--location-name**|string|Location Name.|location_name|locationName| + +### group `az blockchain sku` +#### Command `az blockchain sku list` + +##### Example +``` +az blockchain sku list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +### group `az blockchain transaction-node` +#### Command `az blockchain transaction-node list` + +##### Example +``` +az blockchain transaction-node list --blockchain-member-name "contosemember1" --resource-group "mygroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain transaction-node show` + +##### Example +``` +az blockchain transaction-node show --blockchain-member-name "contosemember1" --resource-group "mygroup" --name \ +"txnode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain transaction-node create` + +##### Example +``` +az blockchain transaction-node create --blockchain-member-name "contosemember1" --resource-group "mygroup" --location \ +"southeastasia" --password "" --name "txnode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--location**|string|Gets or sets the transaction node location.|location|location| +|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password|password| +|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules|firewallRules| + +#### Command `az blockchain transaction-node update` + +##### Example +``` +az blockchain transaction-node update --blockchain-member-name "contosemember1" --resource-group "mygroup" --password \ +"" --name "txnode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--password**|string|Sets the transaction node dns endpoint basic auth password.|password|password| +|**--firewall-rules**|array|Gets or sets the firewall rules.|firewall_rules|firewallRules| + +#### Command `az blockchain transaction-node delete` + +##### Example +``` +az blockchain transaction-node delete --blockchain-member-name "contosemember1" --resource-group "mygroup" --name \ +"txNode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain transaction-node list-api-key` + +##### Example +``` +az blockchain transaction-node list-api-key --blockchain-member-name "contosemember1" --resource-group "mygroup" \ +--name "txnode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| + +#### Command `az blockchain transaction-node regenerate-api-key` + +##### Example +``` +az blockchain transaction-node regenerate-api-key --key-name "key1" --blockchain-member-name "contosemember1" \ +--resource-group "mygroup" --name "txnode2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--blockchain-member-name**|string|Blockchain member name.|blockchain_member_name|blockchainMemberName| +|**--transaction-node-name**|string|Transaction node name.|transaction_node_name|transactionNodeName| +|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--key-name**|string|Gets or sets the API key name.|key_name|keyName| +|**--value**|string|Gets or sets the API key value.|value|value| diff --git a/src/blockchain/setup.py b/src/blockchain/setup.py index 25866d26486..68f52309092 100644 --- a/src/blockchain/setup.py +++ b/src/blockchain/setup.py @@ -9,9 +9,12 @@ from codecs import open from setuptools import setup, find_packages -# TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. VERSION = '0.1.0' +try: + from azext_blockchain.manual.version import VERSION +except ImportError: + pass # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -27,9 +30,13 @@ 'License :: OSI Approved :: MIT License', ] -# TODO: Add any additional SDK dependencies here DEPENDENCIES = [] +try: + from azext_blockchain.manual.dependency import DEPENDENCIES +except ImportError: + pass + with open('README.md', 'r', encoding='utf-8') as f: README = f.read() with open('HISTORY.rst', 'r', encoding='utf-8') as f: @@ -39,7 +46,6 @@ name='blockchain', version=VERSION, description='Microsoft Azure Command-Line Tools BlockchainManagementClient Extension', - # TODO: Update author and email, if applicable author='Microsoft Corporation', author_email='azpycli@microsoft.com', url='https://github.com/Azure/azure-cli-extensions/tree/master/src/blockchain',