From b4ac83a8de1076f634a88f719a88548a22f07a94 Mon Sep 17 00:00:00 2001 From: vthiebaut10 <81188381+vthiebaut10@users.noreply.github.com> Date: Wed, 13 Oct 2021 21:46:09 -0400 Subject: [PATCH] Revert "Connect to Arc Servers" (#3956) * Revert "Connect to Arc Servers (#3929)" This reverts commit 78264f6705c0d4920dfce612d27758509dea0c9d. * Updated to version 0.1.8 and updated history notes * Fixed typo * Fixed another typo * Change in history --- linter_exclusions.yml | 5 - src/ssh/HISTORY.md | 10 +- src/ssh/azext_ssh/_client_factory.py | 36 - src/ssh/azext_ssh/_help.py | 48 +- src/ssh/azext_ssh/_params.py | 33 - src/ssh/azext_ssh/commands.py | 1 - src/ssh/azext_ssh/constants.py | 10 - src/ssh/azext_ssh/custom.py | 254 +-- src/ssh/azext_ssh/file_utils.py | 33 - src/ssh/azext_ssh/ssh_utils.py | 167 +- src/ssh/azext_ssh/tests/latest/test_custom.py | 384 +--- .../azext_ssh/tests/latest/test_ssh_utils.py | 251 +-- src/ssh/azext_ssh/vendored_sdks/__init__.py | 12 - .../connectedmachine/__init__.py | 16 - .../connectedmachine/_configuration.py | 70 - .../connectedmachine/_connected_machine.py | 95 - .../connectedmachine/aio/__init__.py | 10 - .../connectedmachine/aio/_configuration.py | 66 - .../aio/_connected_machine.py | 89 - .../aio/operations/__init__.py | 25 - .../_connected_machine_operations.py | 142 -- .../_machine_extensions_operations.py | 571 ------ .../aio/operations/_machines_operations.py | 494 ----- .../aio/operations/_operations.py | 105 - ...private_endpoint_connections_operations.py | 432 ---- .../_private_link_resources_operations.py | 180 -- .../_private_link_scopes_operations.py | 611 ------ .../connectedmachine/models/__init__.py | 164 -- .../models/_connected_machine_enums.py | 64 - .../connectedmachine/models/_models.py | 1693 --------------- .../connectedmachine/models/_models_py3.py | 1826 ----------------- .../connectedmachine/operations/__init__.py | 25 - .../_connected_machine_operations.py | 148 -- .../_machine_extensions_operations.py | 583 ------ .../operations/_machines_operations.py | 505 ----- .../operations/_operations.py | 110 - ...private_endpoint_connections_operations.py | 442 ---- .../_private_link_resources_operations.py | 186 -- .../_private_link_scopes_operations.py | 624 ------ .../vendored_sdks/connectedmachine/py.typed | 1 - src/ssh/setup.py | 5 +- 41 files changed, 163 insertions(+), 10363 deletions(-) delete mode 100644 src/ssh/azext_ssh/_client_factory.py delete mode 100644 src/ssh/azext_ssh/constants.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/_configuration.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/_connected_machine.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_configuration.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_connected_machine.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_connected_machine_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machine_extensions_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machines_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_resources_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_scopes_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_connected_machine_enums.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models_py3.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/__init__.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_connected_machine_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machine_extensions_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machines_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_endpoint_connections_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_resources_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_scopes_operations.py delete mode 100644 src/ssh/azext_ssh/vendored_sdks/connectedmachine/py.typed diff --git a/linter_exclusions.yml b/linter_exclusions.yml index 9cdc0a76826..8a740c4d0c7 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -2120,11 +2120,6 @@ ssh vm: ssh_args: rule_exclusions: - no_positional_parameters -ssh arc: - parameters: - ssh_args: - rule_exclusions: - - no_positional_parameters storage account create: parameters: hierarchical_namespace: diff --git a/src/ssh/HISTORY.md b/src/ssh/HISTORY.md index ffde4f9a006..01034ca9e55 100644 --- a/src/ssh/HISTORY.md +++ b/src/ssh/HISTORY.md @@ -1,10 +1,12 @@ Release History =============== +0.1.8 +----- +* Rollback from version 0.1.7 to 0.1.6 to remove preview features. + 0.1.7 ----- -* Add support for connecting to Arc Servers using AAD issued certificates. -* Add support for connecting to local users on Azure VMs and Arc Server using certs-based, key-based, and password-based authentication -* Add --ssh-client-path, --resource-id, --local-user, --cert-file, and --delete-privkey arguments. +* Introduced preview features. 0.1.6 ----- @@ -47,4 +49,4 @@ Release History 0.1.0 ----- -* Initial release. \ No newline at end of file +* Initial release. diff --git a/src/ssh/azext_ssh/_client_factory.py b/src/ssh/azext_ssh/_client_factory.py deleted file mode 100644 index f2b14f3e0b1..00000000000 --- a/src/ssh/azext_ssh/_client_factory.py +++ /dev/null @@ -1,36 +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. -# -------------------------------------------------------------------------- - - -def cf_connectedmachine_cl(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azext_ssh.vendored_sdks.connectedmachine import ConnectedMachine - return get_mgmt_service_client(cli_ctx, - ConnectedMachine) - - -def cf_machine(cli_ctx, *_): - return cf_connectedmachine_cl(cli_ctx).machines - - -def cf_machine_extension(cli_ctx, *_): - return cf_connectedmachine_cl(cli_ctx).machine_extensions - - -def cf_private_link_scope(cli_ctx, *_): - return cf_connectedmachine_cl(cli_ctx).private_link_scopes - - -def cf_private_link_resource(cli_ctx, *_): - return cf_connectedmachine_cl(cli_ctx).private_link_resources - - -def cf_private_endpoint_connection(cli_ctx, *_): - return cf_connectedmachine_cl(cli_ctx).private_endpoint_connections diff --git a/src/ssh/azext_ssh/_help.py b/src/ssh/azext_ssh/_help.py index d7537b43b8e..b049a3a3c7f 100644 --- a/src/ssh/azext_ssh/_help.py +++ b/src/ssh/azext_ssh/_help.py @@ -7,18 +7,17 @@ helps['ssh'] = """ type: group - short-summary: SSH into resources (Azure VMs, Arc servers, etc) using AAD issued openssh certificates. + short-summary: SSH into resources (Azure VMs, etc) using AAD issued openssh certificates """ helps['ssh vm'] = """ type: command - short-summary: SSH into Azure VMs or Arc Servers. - long-summary: Users can now login using AAD issued certificates or using local user credentials. We recommend login using AAD issued certificates as azure automatically rotate SSH CA keys. To SSH as a local user in the target machine, you must provide the local user name using the --local-user argument. + short-summary: SSH into Azure VMs using an ssh certificate examples: - - name: Give a resource group and VM to SSH using AAD issued certificates + - name: Give a resource group and VM to SSH to text: | - az ssh vm --resource-group myResourceGroup --vm-name myVM - - name: Give the public IP (or hostname) of a VM to SSH to SSH using AAD issued certificates + az ssh vm --resource-group myResourceGroup --vm-name myVm + - name: Give the public IP (or hostname) of a VM to SSH to text: | az ssh vm --ip 1.2.3.4 az ssh vm --hostname example.com @@ -28,18 +27,6 @@ - name: Using additional ssh arguments text: | az ssh vm --ip 1.2.3.4 -- -A -o ForwardX11=yes - - name: Give the Resource ID of a VM to SSH using AAD issued certificates. Using the resource ID to identify the target machine is useful when there is an Azure VM and a Arc Server with the same name in the same resource group. - text: | - az ssh vm --resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM - - name: Give a local user name to SSH using local user credentials on the target machine using certificate based authentication. - text: | - az ssh vm --local-user username --ip 1.2.3.4 --certificate-file cert.pub --private-key key - - name: Give a local user name to SSH using local user credentials on the target machine using key based authentication. - text: | - az ssh vm --local-user username --resource-group myResourceGroup --vm-name myVM --private-key-file key - - name: Give a local user name to SSH using local user credentials on the target machine using password based authentication. - text: | - az ssh vm --local-user username --resource-id /subscriptions/mySubsription/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myArcServer """ helps['ssh config'] = """ @@ -76,28 +63,3 @@ text: | az ssh cert --public-key-file ./id_rsa.pub --file ./id_rsa-aadcert.pub """ - -helps['ssh arc'] = """ - type: command - short-summary: SSH into Azure Arc Servers - long-summary: Users can now login using AAD issued certificates or using local user credentials. We recommend login using AAD issued certificates as azure automatically rotate SSH CA keys. To SSH as a local user in the target machine, you must provide the local user name using the --local-user argument. - examples: - - name: Give a resource group and Arc Server Name to SSH using AAD issued certificates - text: | - az ssh arc --resource-group myResourceGroup --vm-name myArcServer - - name: Give the Resource ID of an Arc Server to SSH using AAD issued certificates - text: | - az ssh arc --resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.HybridCompute/machines/myArcServer - - name: Using a custom private key file - text: | - az ssh arc --resource-group myResourceGroup --vm-name myArcServer --private-key-file key --public-key-file key.pub - - name: Give a local user name to SSH to a local user using certificate-based authentication - text: | - az ssh arc --resource-group myResourceGroup --vm-name myArcServer --certificate-file cert.pub --private-key key --local-user name - - name: Give a local user name to SSH to a local user using key-based authentication - text: | - az ssh arc --resource-group myRG --vm-name myVM --local-user name --private-key-file key - - name: Give a local user name to SSH to a local user using password-based authentication - text: | - az ssh arc --resource-id /subscriptions/mySubsription/resourceGroups/myRG/providers/Microsoft.HybridCompute/machines/myArcServer --local-user username -""" diff --git a/src/ssh/azext_ssh/_params.py b/src/ssh/azext_ssh/_params.py index ce3ad0b4dd5..9a4d4c06a94 100644 --- a/src/ssh/azext_ssh/_params.py +++ b/src/ssh/azext_ssh/_params.py @@ -10,58 +10,25 @@ def load_arguments(self, _): c.argument('vm_name', options_list=['--vm-name', '--name', '-n'], help='The name of the VM') c.argument('ssh_ip', options_list=['--ip', '--hostname'], help='The public (or reachable private) IP address (or hostname) of the VM') - c.argument('resource_id', options_list=['--resource-id'], help='The Resource ID of the Azure VM or Arc Server') c.argument('public_key_file', options_list=['--public-key-file', '-p'], help='The RSA public key file path') c.argument('private_key_file', options_list=['--private-key-file', '-i'], help='The RSA private key file path') c.argument('use_private_ip', options_list=['--prefer-private-ip'], help='Will prefer private IP. Requires connectivity to the private IP.') - c.argument('local_user', options_list=['--local-user'], - help='The username for a local user') - c.argument('cert_file', options_list=['--certificate-file', '-c'], - help='Path to a certificate file used for authentication when using local user credentials.') c.argument('port', options_list=['--port'], help='SSH port') - c.argument('ssh_client_path', options_list=['--ssh-client-path'], - help='Path to ssh executable. Default to ssh pre-installed if not provided.') - c.argument('delete_privkey', options_list=['--delete-private-key'], - help=('This is an internal argument. This argument is used by Azure Portal to provide a one click ' - 'SSH login experience in Cloud shell.'), - deprecate_info=c.deprecate(hide=True), action='store_true') c.positional('ssh_args', nargs='*', help='Additional arguments passed to OpenSSH') with self.argument_context('ssh config') as c: c.argument('config_path', options_list=['--file', '-f'], help='The file path to write the SSH config to') c.argument('vm_name', options_list=['--vm-name', '--name', '-n'], help='The name of the VM') c.argument('ssh_ip', options_list=['--ip'], help='The public IP address (or hostname) of the VM') - c.argument('resource_id', options_list=['--resource-id'], help='The Resource ID of the Azure VM or Arc Server') c.argument('public_key_file', options_list=['--public-key-file', '-p'], help='The RSA public key file path') c.argument('private_key_file', options_list=['--private-key-file', '-i'], help='The RSA private key file path') c.argument('use_private_ip', options_list=['--prefer-private-ip'], help='Will use a private IP if available. By default only public IPs are used.') - c.argument('local_user', options_list=['--local-user'], - help='The username for a local user') c.argument('overwrite', action='store_true', options_list=['--overwrite'], help='Overwrites the config file if this flag is set') - c.argument('port', options_list=['--port'], help='Port to connect to on the remote host.') - c.argument('cert_file', options_list=['--certificate-file', '-c'], help='Path to certificate file') with self.argument_context('ssh cert') as c: c.argument('cert_path', options_list=['--file', '-f'], help='The file path to write the SSH cert to, defaults to public key path with -aadcert.pub appened') c.argument('public_key_file', options_list=['--public-key-file', '-p'], help='The RSA public key file path') - - with self.argument_context('ssh arc') as c: - c.argument('vm_name', options_list=['--vm-name', '--name', '-n'], help='The name of the Arc Server') - c.argument('public_key_file', options_list=['--public-key-file', '-p'], help='The RSA public key file path') - c.argument('private_key_file', options_list=['--private-key-file', '-i'], help='The RSA private key file path') - c.argument('local_user', options_list=['--local-user'], - help='The username for a local user') - c.argument('cert_file', options_list=['--certificate-file', '-c'], help='Path to certificate file') - c.argument('resource_id', options_list=['--resource-id'], help='The Resource ID of the Arc Server') - c.argument('port', options_list=['--port'], help='Port to connect to on the remote host.') - c.argument('ssh_client_path', options_list=['--ssh-client-path'], - help='Path to ssh executable. Default to ssh pre-installed if not provided.') - c.argument('delete_privkey', options_list=['--delete-private-key'], - help=('This is an internal argument. This argument is used by Azure Portal to provide a one click ' - 'SSH login experience in Cloud shell.'), - deprecate_info=c.deprecate(hide=True), action='store_true') - c.positional('ssh_args', nargs='*', help='Additional arguments passed to OpenSSH') diff --git a/src/ssh/azext_ssh/commands.py b/src/ssh/azext_ssh/commands.py index 335ba21eca6..44fcd1e736f 100644 --- a/src/ssh/azext_ssh/commands.py +++ b/src/ssh/azext_ssh/commands.py @@ -10,4 +10,3 @@ def load_command_table(self, _): g.custom_command('vm', 'ssh_vm') g.custom_command('config', 'ssh_config') g.custom_command('cert', 'ssh_cert') - g.custom_command('arc', 'ssh_arc') diff --git a/src/ssh/azext_ssh/constants.py b/src/ssh/azext_ssh/constants.py deleted file mode 100644 index 9be7ef75418..00000000000 --- a/src/ssh/azext_ssh/constants.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -CLIENT_PROXY_VERSION = "1.3.017131" -CLIENT_PROXY_RELEASE = "release10-09-21" -CLIENT_PROXY_STORAGE_URL = "https://sshproxysa.blob.core.windows.net" -CLEANUP_TOTAL_TIME_LIMIT_IN_SECONDS = 120 -CLEANUP_TIME_INTERVAL_IN_SECONDS = 10 diff --git a/src/ssh/azext_ssh/custom.py b/src/ssh/azext_ssh/custom.py index e93a6ac9353..036fc2aa751 100644 --- a/src/ssh/azext_ssh/custom.py +++ b/src/ssh/azext_ssh/custom.py @@ -8,41 +8,25 @@ import hashlib import json import tempfile -import urllib.request -import base64 -import stat -from glob import glob from azure.cli.core import azclierror -from msrestazure import tools from . import ip_utils from . import rsa_parser from . import ssh_utils -from . import constants as consts -from . import file_utils -def ssh_vm(cmd, resource_group_name=None, vm_name=None, resource_id=None, ssh_ip=None, public_key_file=None, - private_key_file=None, use_private_ip=False, local_user=None, cert_file=None, port=None, - ssh_client_path=None, delete_privkey=False, ssh_args=None): +def ssh_vm(cmd, resource_group_name=None, vm_name=None, ssh_ip=None, public_key_file=None, + private_key_file=None, use_private_ip=False, port=None, ssh_args=None): + op_call = functools.partial(ssh_utils.start_ssh_connection, port, ssh_args) + _do_ssh_op(cmd, resource_group_name, vm_name, ssh_ip, + public_key_file, private_key_file, use_private_ip, op_call) - _assert_args(resource_group_name, vm_name, ssh_ip, resource_id, cert_file, local_user) - do_ssh_op = _decide_op_call(cmd, resource_group_name, vm_name, resource_id, ssh_ip, None, None, - ssh_client_path, ssh_args, delete_privkey) - do_ssh_op(cmd, ssh_ip, public_key_file, private_key_file, local_user, - cert_file, port, use_private_ip) - -def ssh_config(cmd, config_path, resource_group_name=None, vm_name=None, ssh_ip=None, resource_id=None, - public_key_file=None, private_key_file=None, overwrite=False, use_private_ip=False, - local_user=None, cert_file=None, port=None): - - _assert_args(resource_group_name, vm_name, ssh_ip, resource_id, cert_file, local_user) - do_ssh_op = _decide_op_call(cmd, resource_group_name, vm_name, resource_id, ssh_ip, config_path, overwrite, - None, None, None) - do_ssh_op(cmd, ssh_ip, public_key_file, private_key_file, local_user, - cert_file, port, use_private_ip) +def ssh_config(cmd, config_path, resource_group_name=None, vm_name=None, ssh_ip=None, + public_key_file=None, private_key_file=None, overwrite=False, use_private_ip=False): + op_call = functools.partial(ssh_utils.write_ssh_config, config_path, resource_group_name, vm_name, overwrite) + _do_ssh_op(cmd, resource_group_name, vm_name, ssh_ip, public_key_file, private_key_file, use_private_ip, op_call) def ssh_cert(cmd, cert_path=None, public_key_file=None): @@ -51,48 +35,19 @@ def ssh_cert(cmd, cert_path=None, public_key_file=None): print(cert_file + "\n") -def ssh_arc(cmd, resource_group_name=None, vm_name=None, resource_id=None, public_key_file=None, private_key_file=None, - local_user=None, cert_file=None, port=None, ssh_client_path=None, delete_privkey=False, ssh_args=None): - - _assert_args(resource_group_name, vm_name, None, resource_id, cert_file, local_user) - - if resource_id: - resource_info = tools.parse_resource_id(resource_id) - if not set(['resource_group', 'resource_name', 'resource_namespace']).issubset(set(resource_info.keys())): - raise azclierror.InvalidArgumentValueError("Resource ID not formated correctly.") - if resource_info['resource_namespace'] != "Microsoft.HybridCompute": - raise azclierror.InvalidArgumentValueError("Resource provider in the Resource ID must be " - "'Microsoft.HybridCompute'") - resource_group_name = resource_info['resource_group'] - vm_name = resource_info['resource_name'] +def _do_ssh_op(cmd, resource_group, vm_name, ssh_ip, public_key_file, private_key_file, use_private_ip, op_call): + _assert_args(resource_group, vm_name, ssh_ip) + public_key_file, private_key_file = _check_or_create_public_private_files(public_key_file, private_key_file) + ssh_ip = ssh_ip or ip_utils.get_ssh_ip(cmd, resource_group, vm_name, use_private_ip) - op_call = functools.partial(ssh_utils.start_ssh_connection, ssh_client_path=ssh_client_path, ssh_args=ssh_args, - delete_privkey=delete_privkey) - _do_ssh_op(cmd, None, public_key_file, private_key_file, local_user, cert_file, port, - False, resource_group_name, vm_name, op_call, True) - - -def _do_ssh_op(cmd, ssh_ip, public_key_file, private_key_file, username, - cert_file, port, use_private_ip, resource_group_name, vm_name, op_call, is_arc): - - proxy_path = None - relay_info = None - if is_arc: - proxy_path = _arc_get_client_side_proxy() - relay_info = _arc_list_access_details(cmd, resource_group_name, vm_name) - else: - ssh_ip = ssh_ip or ip_utils.get_ssh_ip(cmd, resource_group_name, vm_name, use_private_ip) - if not ssh_ip: - if not use_private_ip: - raise azclierror.ResourceNotFoundError(f"VM '{vm_name}' does not have a public IP address to SSH to") - raise azclierror.ResourceNotFoundError(f"VM '{vm_name}' does not have a public or private IP address to" - "SSH to") + if not ssh_ip: + if not use_private_ip: + raise azclierror.ResourceNotFoundError(f"VM '{vm_name}' does not have a public IP address to SSH to") - if not username: - public_key_file, private_key_file = _check_or_create_public_private_files(public_key_file, private_key_file) - cert_file, username = _get_and_write_certificate(cmd, public_key_file, None) + raise azclierror.ResourceNotFoundError(f"VM '{vm_name}' does not have a public or private IP address to SSH to") - op_call(relay_info, proxy_path, vm_name, ssh_ip, username, cert_file, private_key_file, port, is_arc) + cert_file, username = _get_and_write_certificate(cmd, public_key_file, None) + op_call(ssh_ip, username, cert_file, private_key_file) def _get_and_write_certificate(cmd, public_key_file, cert_file): @@ -151,11 +106,10 @@ def _prepare_jwk_data(public_key_file): return data -def _assert_args(resource_group, vm_name, ssh_ip, resource_id, cert_file, username): - if not (resource_group or vm_name or ssh_ip or resource_id): +def _assert_args(resource_group, vm_name, ssh_ip): + if not (resource_group or vm_name or ssh_ip): raise azclierror.RequiredArgumentMissingError( - "The VM must be specified by --ip or --resource-group and " - "--vm-name/--name or --resource_id") + "The VM must be specified by --ip or --resource-group and --vm-name/--name") if resource_group and not vm_name or vm_name and not resource_group: raise azclierror.MutuallyExclusiveArgumentError( @@ -165,21 +119,6 @@ def _assert_args(resource_group, vm_name, ssh_ip, resource_id, cert_file, userna raise azclierror.MutuallyExclusiveArgumentError( "--ip cannot be used with --resource-group or --vm-name/--name") - if ssh_ip and resource_id: - raise azclierror.MutuallyExclusiveArgumentError( - "--ip cannot be used with --resource-id") - - if resource_id and (vm_name or resource_group): - raise azclierror.MutuallyExclusiveArgumentError( - "--resource-id cannot be used with --resource-group or --vm-name/--name") - - if cert_file and not username: - raise azclierror.MutuallyExclusiveArgumentError( - "To authenticate with a certificate you need to provide a --local-user") - - if cert_file and not os.path.isfile(cert_file): - raise azclierror.FileOperationError(f"Certificate file {cert_file} not found") - def _check_or_create_public_private_files(public_key_file, private_key_file): # If nothing is passed in create a temporary directory with a ephemeral keypair @@ -230,152 +169,3 @@ def _get_modulus_exponent(public_key_file): exponent = parser.exponent return modulus, exponent - - -# Downloads client side proxy to connect to Arc Connectivity Platform -def _arc_get_client_side_proxy(): - import platform - operating_system = platform.system() - machine = platform.machine() - - if machine.endswith('64'): - architecture = 'amd64' - elif machine.endswith('86'): - architecture = '386' - elif machine == '': - raise azclierror.BadRequestError("Couldn't identify the platform architecture.") - else: - raise azclierror.BadRequestError(f"Unsuported architecture: {machine} is not currently supported") - - # define the request url and install location based on the os and architecture - request_uri = (f"{consts.CLIENT_PROXY_STORAGE_URL}/{consts.CLIENT_PROXY_RELEASE}" - f"/sshProxy_{operating_system.lower()}_{architecture}_{consts.CLIENT_PROXY_VERSION}") - proxy_name = 'argSSHProxy' + consts.CLIENT_PROXY_VERSION - install_location = os.path.join(".clientsshproxy", proxy_name.replace('.', '_')) - older_version_location = os.path.join(".clientsshproxy", 'argSSHProxy*') - - if operating_system == 'Windows': - request_uri = request_uri + ".exe" - install_location = install_location + ".exe" - older_version_location = older_version_location + ".exe" - elif operating_system not in ('Linux', 'Darwin'): - raise azclierror.BadRequestError(f"Unsuported OS: {operating_system} platform is not currently supported") - - install_location = os.path.expanduser(os.path.join('~', install_location)) - older_version_location = os.path.expanduser(os.path.join('~', older_version_location)) - install_dir = os.path.dirname(install_location) - - # Only download new proxy if it doesn't exist already - if not os.path.isfile(install_location): - # download the executable - try: - with urllib.request.urlopen(request_uri) as response: - response_content = response.read() - response.close() - except Exception as e: - raise azclierror.ClientRequestError(f"Failed to download client proxy executable from {request_uri}. " - "Error: " + str(e)) from e - - # if directory doesn't exist, create it - if not os.path.exists(install_dir): - file_utils.create_directory(install_dir, f"Failed to create client proxy directory '{install_dir}'. ") - # if directory exists, delete any older versions of the proxy - else: - older_version_files = glob(older_version_location) - for f in older_version_files: - file_utils.delete_file(f, f"failed to delete older version file {f}", warning=True) - - # write executable in the install location - file_utils.write_to_file(install_location, 'wb', response_content, "Failed to create client proxy file. ") - os.chmod(install_location, os.stat(install_location).st_mode | stat.S_IXUSR) - - return install_location - - -# Get the Access Details to connect to Arc Connectivity platform from the HybridCompute Resource Provider -# TO DO: This is a temporary API call to get the relay info. We will move to a different one in the future. -def _arc_list_access_details(cmd, resource_group, vm_name): - from azext_ssh._client_factory import cf_machine - client = cf_machine(cmd.cli_ctx) - status_code, result = client.list_access_details(resource_group_name=resource_group, machine_name=vm_name) - if status_code in [501, 404]: - error = {404: 'Not Found', 501: 'Not Implemented'} - raise azclierror.BadRequestError("REST API request for access information returned an invalid status " - f"\"{error[status_code]}\". Please update the current version of the SSH" - "extension by runing \"az extension update ssh\".") - result = result.replace("\'", "\"") - result_bytes = result.encode("ascii") - enc = base64.b64encode(result_bytes) - base64_result_string = enc.decode("ascii") - return base64_result_string - - -def _decide_op_call(cmd, resource_group_name, vm_name, resource_id, ssh_ip, config_path, overwrite, - ssh_client_path, ssh_args, delete_privkey): - - # If the user provides an IP address the target will be treated as an Azure VM even if it is an - # Arc Server. Which just means that the Connectivity Proxy won't be used to establish connection. - is_arc_server = False - - if ssh_ip: - is_arc_server = False - - elif resource_id: - resource_info = tools.parse_resource_id(resource_id) - if not set(['resource_group', 'resource_name', 'resource_namespace']).issubset(set(resource_info.keys())): - raise azclierror.InvalidArgumentValueError("Resource ID not formated correctly.") - resource_group_name = resource_info['resource_group'] - vm_name = resource_info['resource_name'] - if resource_info['resource_namespace'] == "Microsoft.HybridCompute": - is_arc_server = True - elif resource_info['resource_namespace'] != "Microsoft.Compute": - error = ("Invalid Resource ID. Resource provider must be Microsoft.Compute if resource is an " - "Azure Virtual Machine, or Microsoft.HybridCompute if it is an Arc Server.") - raise azclierror.InvalidArgumentValueError(error) - - else: - is_azure_vm = _check_if_azure_vm(cmd, resource_group_name, vm_name) - is_arc_server = _check_if_arc_server(cmd, resource_group_name, vm_name) - - if is_azure_vm and is_arc_server: - raise azclierror.BadRequestError(f"{resource_group_name} has Azure VM and Arc Server with the " - f"same name: {vm_name}. Please try with --resource-id instead " - "of --vm-name and --resource-group") - if not is_azure_vm and not is_arc_server: - from azure.core.exceptions import ResourceNotFoundError - raise ResourceNotFoundError(f"The Resource {vm_name} under resource group '{resource_group_name}' " - "was not found.") - - if config_path: - op_call = functools.partial(ssh_utils.write_ssh_config, config_path=config_path, overwrite=overwrite, - resource_group=resource_group_name) - else: - op_call = functools.partial(ssh_utils.start_ssh_connection, ssh_client_path=ssh_client_path, ssh_args=ssh_args, - delete_privkey=delete_privkey) - do_ssh_op = functools.partial(_do_ssh_op, resource_group_name=resource_group_name, vm_name=vm_name, - is_arc=is_arc_server, op_call=op_call) - - return do_ssh_op - - -def _check_if_azure_vm(cmd, resource_group_name, vm_name): - from azure.cli.core.commands import client_factory - from azure.cli.core import profiles - from azure.core.exceptions import ResourceNotFoundError - try: - compute_client = client_factory.get_mgmt_service_client(cmd.cli_ctx, profiles.ResourceType.MGMT_COMPUTE) - compute_client.virtual_machines.get(resource_group_name, vm_name) - except ResourceNotFoundError: - return False - return True - - -def _check_if_arc_server(cmd, resource_group_name, vm_name): - from azure.core.exceptions import ResourceNotFoundError - from azext_ssh._client_factory import cf_machine - client = cf_machine(cmd.cli_ctx) - try: - client.get(resource_group_name=resource_group_name, machine_name=vm_name) - except ResourceNotFoundError: - return False - return True diff --git a/src/ssh/azext_ssh/file_utils.py b/src/ssh/azext_ssh/file_utils.py index f3ecebf8b7f..3c3bd795c15 100644 --- a/src/ssh/azext_ssh/file_utils.py +++ b/src/ssh/azext_ssh/file_utils.py @@ -5,10 +5,6 @@ import errno import os -from azure.cli.core import azclierror -from knack import log - -logger = log.get_logger(__name__) def make_dirs_for_file(file_path): @@ -24,32 +20,3 @@ def mkdir_p(path): pass else: raise - - -def delete_file(file_path, message, warning=False): - try: - os.remove(file_path) - except Exception as e: - if warning: - logger.warning(message) - else: - raise azclierror.FileOperationError(message + "Error: " + str(e)) from e - - -def create_directory(file_path, error_message): - try: - os.makedirs(file_path) - except Exception as e: - raise azclierror.FileOperationError(error_message + "Error: " + str(e)) from e - - -def write_to_file(file_path, mode, content, error_message, encoding=None): - try: - if encoding: - with open(file_path, mode, encoding=encoding) as f: - f.write(content) - else: - with open(file_path, mode) as f: - f.write(content) - except Exception as e: - raise azclierror.FileOperationError(error_message + "Error: " + str(e)) from e diff --git a/src/ssh/azext_ssh/ssh_utils.py b/src/ssh/azext_ssh/ssh_utils.py index 0b3f7d2c424..e48d1ab51a8 100644 --- a/src/ssh/azext_ssh/ssh_utils.py +++ b/src/ssh/azext_ssh/ssh_utils.py @@ -5,85 +5,21 @@ import os import platform import subprocess -import tempfile -import stat -import multiprocessing as mp -import time -import re -import oschmod from knack import log from azure.cli.core import azclierror -from . import file_utils -from . import constants as const - logger = log.get_logger(__name__) -def start_ssh_connection(relay_info, proxy_path, vm_name, ip, username, cert_file, private_key_file, port, - is_arc, ssh_client_path, ssh_args, delete_privkey): - - if not ssh_client_path: - ssh_client_path = _get_ssh_path() +def start_ssh_connection(port, ssh_args, ip, username, cert_file, private_key_file): ssh_arg_list = [] if ssh_args: ssh_arg_list = ssh_args - env = os.environ.copy() - - ssh_client_log_file_arg = [] - # delete_privkey is only true for injected commands in the portal one click ssh experience - if delete_privkey and (cert_file or private_key_file): - if '-E' in ssh_arg_list: - # This condition should rarely be true - index = ssh_arg_list.index('-E') - log_file = ssh_arg_list[index + 1] - else: - if cert_file: - log_dir = os.path.dirname(cert_file) - elif private_key_file: - log_dir = os.path.dirname(private_key_file) - log_file_name = 'ssh_client_log_' + str(os.getpid()) - log_file = os.path.join(log_dir, log_file_name) - ssh_client_log_file_arg = ['-E', log_file] - - if '-v' not in ssh_arg_list and '-vv' not in ssh_arg_list and '-vvv' not in ssh_arg_list: - ssh_client_log_file_arg = ssh_client_log_file_arg + ['-v'] - - if is_arc: - env['SSHPROXY_RELAY_INFO'] = relay_info - if port: - pcommand = f"ProxyCommand={proxy_path} -p {port}" - else: - pcommand = f"ProxyCommand={proxy_path}" - args = ["-o", pcommand] + _build_args(cert_file, private_key_file, None) - host = _get_host(username, vm_name) - else: - host = _get_host(username, ip) - args = _build_args(cert_file, private_key_file, port) - - command = [ssh_client_path, host] - command = command + args + ssh_client_log_file_arg + ssh_arg_list - - # If delete_privkey flag is true, we will try to clean the private key file and the certificate file - # once the connection has been established. If it's not possible to open the log file, we default to - # waiting for about 2 minutes once the ssh process starts before cleaning up the files. - if delete_privkey and (cert_file or private_key_file): - if os.path.isfile(log_file): - file_utils.delete_file(log_file, f"Couldn't delete existing log file {log_file}", True) - cleanup_process = mp.Process(target=_do_cleanup, args=(private_key_file, cert_file, log_file)) - cleanup_process.start() - + command = [_get_ssh_path(), _get_host(username, ip)] + command = command + _build_args(cert_file, private_key_file, port) + ssh_arg_list logger.debug("Running ssh command %s", ' '.join(command)) - subprocess.call(command, shell=platform.system() == 'Windows', env=env) - - # If the cleanup process is still alive once the ssh process is terminated, we terminate it and make - # sure the private key and certificate are deleted. - if delete_privkey and (cert_file or private_key_file): - if cleanup_process.is_alive(): - cleanup_process.terminate() - time.sleep(1) - _do_cleanup(private_key_file, cert_file) + subprocess.call(command, shell=platform.system() == 'Windows') def create_ssh_keyfile(private_key_file): @@ -114,51 +50,28 @@ def get_ssh_cert_principals(cert_file): return principals -def write_ssh_config(relay_info, proxy_path, vm_name, ip, username, - cert_file, private_key_file, port, is_arc, config_path, overwrite, resource_group): - - common_lines = [] - common_lines.append("\tUser " + username) - if cert_file: - common_lines.append("\tCertificateFile " + cert_file) - if private_key_file: - common_lines.append("\tIdentityFile " + private_key_file) +def write_ssh_config(config_path, resource_group, vm_name, overwrite, + ip, username, cert_file, private_key_file): lines = [""] - if is_arc: - if cert_file: - relay_info_dir = os.path.dirname(cert_file) - elif private_key_file: - relay_info_dir = os.path.dirname(private_key_file) - else: - relay_info_dir = tempfile.mkdtemp(prefix="ssharcrelayinfo") - relay_info_path = os.path.join(relay_info_dir, "relay_info") - file_utils.write_to_file(relay_info_path, 'w', relay_info, - f"Couldn't write relay information to file {relay_info_path}", 'utf-8') - oschmod.set_mode(relay_info_path, stat.S_IRUSR) + if resource_group and vm_name: lines.append("Host " + resource_group + "-" + vm_name) - lines = lines + common_lines - if port: - lines.append("\tProxyCommand " + proxy_path + " " + "-r " + relay_info_path + " " + "-p " + port) - else: - lines.append("\tProxyCommand " + proxy_path + " " + "-r " + relay_info_path) - else: - if resource_group and vm_name: - lines.append("Host " + resource_group + "-" + vm_name) - lines.append("\tHostName " + ip) - lines = lines + common_lines - if port: - lines.append("\tPort " + port) - - # default to all hosts for config - if not ip: - ip = "*" - - lines.append("Host " + ip) - lines = lines + common_lines - if port: - lines.append("\tPort " + port) + lines.append("\tUser " + username) + lines.append("\tHostName " + ip) + lines.append("\tCertificateFile " + cert_file) + if private_key_file: + lines.append("\tIdentityFile " + private_key_file) + + # default to all hosts for config + if not ip: + ip = "*" + + lines.append("Host " + ip) + lines.append("\tUser " + username) + lines.append("\tCertificateFile " + cert_file) + if private_key_file: + lines.append("\tIdentityFile " + private_key_file) if overwrite: mode = 'w' @@ -191,46 +104,16 @@ def _get_ssh_path(ssh_command="ssh"): return ssh_path -def _get_host(username, target): - return username + "@" + target +def _get_host(username, ip): + return username + "@" + ip def _build_args(cert_file, private_key_file, port): private_key = [] port_arg = [] - certificate = [] if private_key_file: private_key = ["-i", private_key_file] if port: port_arg = ["-p", port] - if cert_file: - certificate = ["-o", "CertificateFile=" + cert_file] + certificate = ["-o", "CertificateFile=" + cert_file] return private_key + certificate + port_arg - - -def _do_cleanup(private_key_file, cert_file, log_file=None): - if os.environ.get("AZUREPS_HOST_ENVIRONMENT") != "cloud-shell/1.0": - raise azclierror.BadRequestError("Can't delete private key file. " - "The --delete-private-key flag set to True, " - "but this is not an Azure Cloud Shell session.") - if log_file: - t0 = time.time() - match = False - while (time.time() - t0) < const.CLEANUP_TOTAL_TIME_LIMIT_IN_SECONDS and not match: - time.sleep(const.CLEANUP_TIME_INTERVAL_IN_SECONDS) - try: - with open(log_file, 'r') as ssh_client_log: - for line in ssh_client_log: - if re.search("debug1: Authentication succeeded", line): - match = True - ssh_client_log.close() - except: - t1 = time.time() - t0 - if t1 < const.CLEANUP_TOTAL_TIME_LIMIT_IN_SECONDS: - time.sleep(const.CLEANUP_TOTAL_TIME_LIMIT_IN_SECONDS - t1) - - if private_key_file and os.path.isfile(private_key_file): - file_utils.delete_file(private_key_file, f"Failed to delete private key file '{private_key_file}'. ") - - if cert_file and os.path.isfile(cert_file): - file_utils.delete_file(cert_file, f"Failed to delete certificate file '{cert_file}'. ") diff --git a/src/ssh/azext_ssh/tests/latest/test_custom.py b/src/ssh/azext_ssh/tests/latest/test_custom.py index 49580239e07..63482a70e28 100644 --- a/src/ssh/azext_ssh/tests/latest/test_custom.py +++ b/src/ssh/azext_ssh/tests/latest/test_custom.py @@ -7,229 +7,98 @@ from azure.cli.core import azclierror from unittest import mock import unittest -import functools from azext_ssh import custom -from azext_ssh import ssh_utils -#from azext_ssh.custom import _do_ssh_op - -from azure.core.exceptions import ResourceNotFoundError class SshCustomCommandTest(unittest.TestCase): - - @mock.patch('azext_ssh.custom._assert_args') @mock.patch('azext_ssh.custom._do_ssh_op') - @mock.patch('azext_ssh.custom._decide_op_call') - def test_ssh_vm(self, mock_decide_op, mock_do_op, mock_assert_args): + @mock.patch('azext_ssh.custom.ssh_utils') + def test_ssh_vm(self, mock_ssh_utils, mock_do_op): cmd = mock.Mock() - op_call = functools.partial(ssh_utils.start_ssh_connection, ssh_client_path='path/to/ssh', ssh_args='ssh_args', delete_privkey=False) - mock_decide_op.return_value = functools.partial(mock_do_op, resource_group_name='rg', vm_name='vm', is_arc=True, op_call=op_call) - custom.ssh_vm(cmd, 'rg', 'vm', 'id', 'ip', 'public', 'private', False, 'user', 'cert', 'port', 'path/to/ssh', False, 'ssh_args') - mock_decide_op.assert_called_once_with(cmd, 'rg', 'vm', 'id', 'ip', None, None, 'path/to/ssh', 'ssh_args', False) - mock_assert_args.assert_called_once_with('rg', 'vm', 'ip', 'id', 'cert', 'user') - mock_do_op.assert_called_once_with(cmd, 'ip', 'public', 'private', 'user', 'cert', 'port', False, resource_group_name='rg', vm_name='vm', is_arc=True, op_call=op_call) - - @mock.patch('azext_ssh.custom._assert_args') + custom.ssh_vm(cmd, "rg", "vm", "ip", "public", "private", False) + + mock_do_op.assert_called_once_with( + cmd, "rg", "vm", "ip", "public", "private", False, mock.ANY) + @mock.patch('azext_ssh.custom._do_ssh_op') - @mock.patch('azext_ssh.custom._decide_op_call') - def test_ssh_config(self, mock_decide_op, mock_do_op, mock_assert_args): + @mock.patch('azext_ssh.ssh_utils.write_ssh_config') + def test_ssh_config(self, mock_ssh_utils, mock_do_op): cmd = mock.Mock() - op_call = functools.partial(ssh_utils.write_ssh_config, config_path='config path', overwrite=False, resource_group='rg') - mock_decide_op.return_value = functools.partial(mock_do_op, resource_group_name='rg', vm_name='vm', is_arc=False, op_call=op_call) - custom.ssh_config(cmd, 'config path', 'rg', 'vm', 'ip', 'id', 'public', 'private', False, False, 'user', 'cert', 'port') - mock_decide_op.assert_called_once_with(cmd, 'rg', 'vm', 'id', 'ip', 'config path', False, None, None, None) - mock_assert_args.assert_called_once_with('rg', 'vm', 'ip', 'id', 'cert', 'user') - mock_do_op.assert_called_once_with(cmd, 'ip', 'public', 'private', 'user', 'cert', 'port', False, resource_group_name='rg', vm_name='vm', is_arc=False, op_call=op_call) + def do_op_side_effect(cmd, resource_group, vm_name, ssh_ip, public_key_file, private_key_file, use_private_ip, op_call): + op_call(ssh_ip, "username", "cert_file", private_key_file) + + mock_do_op.side_effect = do_op_side_effect + custom.ssh_config(cmd, "path/to/file", "rg", "vm", "ip", "public", "private", False, False) + + mock_ssh_utils.assert_called_once_with("path/to/file", "rg", "vm", False, "ip", "username", "cert_file", "private") + + mock_do_op.assert_called_once_with( + cmd, "rg", "vm", "ip", "public", "private", False, mock.ANY) + + @mock.patch('azext_ssh.ssh_utils.get_ssh_cert_principals') + @mock.patch('os.path.join') @mock.patch('azext_ssh.custom._assert_args') - @mock.patch('msrestazure.tools.parse_resource_id') - @mock.patch('azext_ssh.custom._do_ssh_op') - def test_ssh_arc_resource_id(self, mock_do_op, mock_parse_id, mock_assert_args): + @mock.patch('azext_ssh.custom._check_or_create_public_private_files') + @mock.patch('azext_ssh.ip_utils.get_ssh_ip') + @mock.patch('azext_ssh.custom._get_modulus_exponent') + @mock.patch('azure.cli.core._profile.Profile') + @mock.patch('azext_ssh.custom._write_cert_file') + def test_do_ssh_op(self, mock_write_cert, mock_ssh_creds, mock_get_mod_exp, mock_ip, + mock_check_files, mock_assert, mock_join, mock_principal): cmd = mock.Mock() - op_call = functools.partial(ssh_utils.start_ssh_connection, ssh_client_path="path_to_ssh", ssh_args="ssh_args", delete_privkey=False) - mock_parse_id.return_value = {'subscription': '00000000-0000-0000-0000-000000000000', - 'resource_group': 'rg', - 'resource_namespace': 'Microsoft.HybridCompute', - 'resource_name': 'vm'} - custom.ssh_arc(cmd, None, None, "id", "public", "private", "user", "certificate", "port", "path/to/ssh", False, "ssh_args") - mock_assert_args.assert_called_once_with(None, None, None, "id", "certificate", "user") - mock_parse_id.assert_called_once_with("id") - # This doesn't work because there is no way to compare the functools objects - #mock_do_op.assert_called_once_with(cmd, None, "public", "private", "user", "certificate", "port", False, "rg", "vm", op_call, True) - + cmd.cli_ctx = mock.Mock() + cmd.cli_ctx.cloud = mock.Mock() + cmd.cli_ctx.cloud.name = "azurecloud" + mock_op = mock.Mock() + mock_check_files.return_value = "public", "private" + mock_principal.return_value = ["username"] + mock_get_mod_exp.return_value = "modulus", "exponent" + profile = mock_ssh_creds.return_value + profile._adal_cache = True + profile.get_msal_token.return_value = "username", "certificate" + mock_join.return_value = "public-aadcert.pub" + + custom._do_ssh_op(cmd, None, None, "1.2.3.4", "publicfile", "privatefile", False, mock_op) + + mock_assert.assert_called_once_with(None, None, "1.2.3.4") + mock_check_files.assert_called_once_with("publicfile", "privatefile") + mock_ip.assert_not_called() + mock_get_mod_exp.assert_called_once_with("public") + mock_write_cert.assert_called_once_with("certificate", "public-aadcert.pub") + mock_op.assert_called_once_with( + "1.2.3.4", "username", "public-aadcert.pub", "private") + @mock.patch('azext_ssh.custom._assert_args') - @mock.patch('msrestazure.tools.parse_resource_id') - def test_ssh_arc_invalid_resource_provider(self, mock_parse_id, mock_assert_args): + @mock.patch('azext_ssh.custom._check_or_create_public_private_files') + @mock.patch('azext_ssh.ip_utils.get_ssh_ip') + @mock.patch('azext_ssh.custom._get_modulus_exponent') + def test_do_ssh_op_no_public_ip(self, mock_get_mod_exp, mock_ip, mock_check_files, mock_assert): cmd = mock.Mock() - mock_parse_id.return_value = {'subscription': '00000000-0000-0000-0000-000000000000', - 'resource_group': 'rg', - 'resource_namespace': 'Microsoft.Compute', - 'resource_name': 'vm'} - self.assertRaises( - azclierror.InvalidArgumentValueError, custom.ssh_arc, cmd, None, None, "id", "public", "private", "user", "cert", "port", "path", False, "args") - mock_assert_args.assert_called_once_with(None, None, None, "id", "cert", "user") - mock_parse_id.assert_called_once_with("id") + mock_op = mock.Mock() + mock_check_files.return_value = "public", "private" + mock_get_mod_exp.return_value = "modulus", "exponent" + mock_ip.return_value = None - def test_decide_op_call_vm_with_ip(self): - cmd = mock.Mock() - expected_result = functools.partial(custom._do_ssh_op, resource_group_name=None, vm_name=None, is_arc=False, - op_call=functools.partial(ssh_utils.start_ssh_connection, ssh_client_path="path", ssh_args="args", delete_privkey=True)) - result = custom._decide_op_call(cmd, None, None, None, "ip", None, None, "path", "args", True) - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - - def test_decide_op_call_config_with_ip(self): - cmd = mock.Mock() - expected_result = functools.partial(custom._do_ssh_op, resource_group_name=None, vm_name=None, is_arc=False, - op_call=functools.partial(ssh_utils.write_ssh_config, config_path='config_path', overwrite=True, resource_group=None)) - result = custom._decide_op_call(cmd, None, None, None, "ip", 'config_path', True, None, None, False) - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - - @mock.patch('msrestazure.tools.parse_resource_id') - def test_decide_op_call_invalid_resource_id(self, mock_parse_id): - cmd = mock.Mock() - mock_parse_id.return_value = {'subscription': '00000000-0000-0000-0000-000000000000', 'resource_group': 'rg', 'resource_name': 'vm'} self.assertRaises( - azclierror.InvalidArgumentValueError, custom._decide_op_call, cmd, None, None, "id", None, None, False, None, None, False) - - @mock.patch('msrestazure.tools.parse_resource_id') - def test_decide_op_call_vm_with_resource_id(self, mock_parse_id): - cmd = mock.Mock() - mock_parse_id.return_value = {'subscription': '00000000-0000-0000-0000-000000000000', 'resource_group': 'rg', 'resource_namespace': 'Microsoft.HybridCompute', 'resource_name': 'vm'} - expected_result = functools.partial(custom._do_ssh_op, resource_group_name='rg', vm_name='vm', is_arc=True, - op_call=functools.partial(ssh_utils.start_ssh_connection, ssh_client_path='path', ssh_args='args', delete_privkey=False)) - result = custom._decide_op_call(cmd, None, None, 'id', None, None, False, 'path', 'args', False) - mock_parse_id.assert_called_once_with('id') - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - - @mock.patch('msrestazure.tools.parse_resource_id') - def test_decide_op_call_config_with_resource_id(self, mock_parse_id): - cmd = mock.Mock() - mock_parse_id.return_value = {'subscription': '00000000-0000-0000-0000-000000000000', 'resource_group': 'rg', 'resource_namespace': 'Microsoft.Compute', 'resource_name': 'vm'} - expected_result = functools.partial(custom._do_ssh_op, resource_group_name='rg', vm_name='vm', is_arc=False, - op_call=functools.partial(ssh_utils.write_ssh_config, config_path='config path', overwrite=True, resource_group='rg')) - result = custom._decide_op_call(cmd, None, None, 'id', None, 'config path', True, None, None, None) - mock_parse_id.assert_called_once_with('id') - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - - @mock.patch('azext_ssh.custom._check_if_azure_vm') - @mock.patch('azext_ssh.custom._check_if_arc_server') - def test_decide_op_call_vm_with_name_and_resource_group_both_true(self, mock_check_arc, mock_check_az_vm): - cmd = mock.Mock() - mock_check_arc.return_value = True - mock_check_az_vm.return_value = True - self.assertRaises( - azclierror.BadRequestError, custom._decide_op_call, cmd, 'rg', 'vm', None, None, None, False, None, None, False) - mock_check_arc.assert_called_once_with(cmd, 'rg', 'vm') - mock_check_az_vm.assert_called_once_with(cmd, 'rg', 'vm') - - @mock.patch('azext_ssh.custom._check_if_azure_vm') - @mock.patch('azext_ssh.custom._check_if_arc_server') - def test_decide_op_call_vm_with_name_and_resource_group_both_false(self, mock_check_arc, mock_check_az_vm): - cmd = mock.Mock() - mock_check_arc.return_value = False - mock_check_az_vm.return_value = False - from azure.core.exceptions import ResourceNotFoundError - self.assertRaises( - ResourceNotFoundError, custom._decide_op_call, cmd, "rg", "vm", None, None, 'config_path', True, None, None, None) - mock_check_arc.assert_called_once_with(cmd, 'rg', 'vm') - mock_check_az_vm.assert_called_once_with(cmd, 'rg', 'vm') + azclierror.ResourceNotFoundError, custom._do_ssh_op, cmd, "rg", "vm", None, + "publicfile", "privatefile", False, mock_op) - @mock.patch('azext_ssh.custom._check_if_azure_vm') - @mock.patch('azext_ssh.custom._check_if_arc_server') - def test_decide_op_call_vm_with_name_and_resource_group(self, mock_check_arc, mock_check_az_vm): - cmd = mock.Mock() - mock_check_arc.return_value = False - mock_check_az_vm.return_value = True - expected_result = functools.partial(custom._do_ssh_op, resource_group_name='rg', vm_name='vm', is_arc=False, - op_call=functools.partial(ssh_utils.start_ssh_connection, ssh_client_path='path', ssh_args='args', delete_privkey=True)) - result = custom._decide_op_call(cmd, 'rg', 'vm', None, None, None, False, "path", "args", True) - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - mock_check_arc.assert_called_once_with(cmd, 'rg', 'vm') - mock_check_az_vm.assert_called_once_with(cmd, 'rg', 'vm') - - @mock.patch('azext_ssh.custom._check_if_azure_vm') - @mock.patch('azext_ssh.custom._check_if_arc_server') - def test_decide_op_call_config_with_name_and_resource_group(self, mock_check_arc, mock_check_az_vm): - cmd = mock.Mock() - mock_check_arc.return_value = True - mock_check_az_vm.return_value = False - expected_result = functools.partial(custom._do_ssh_op, resource_group_name='rg', vm_name='vm', is_arc=True, - op_call=functools.partial(ssh_utils.write_ssh_config, config_path='config path', overwrite=True, resource_group='rg')) - result = custom._decide_op_call(cmd, 'rg', 'vm', None, None, 'config path', True, None, None, False) - self.assertEqual(expected_result.func, result.func) - self.assertEqual(expected_result.args, result.args) - self.assertEqual(expected_result.keywords['resource_group_name'], result.keywords['resource_group_name']) - self.assertEqual(expected_result.keywords['vm_name'], result.keywords['vm_name']) - self.assertEqual(expected_result.keywords['is_arc'], result.keywords['is_arc']) - self.assertEqual(expected_result.keywords['op_call'].func, result.keywords['op_call'].func) - self.assertEqual(expected_result.keywords['op_call'].args, result.keywords['op_call'].args) - self.assertEqual(expected_result.keywords['op_call'].keywords, result.keywords['op_call'].keywords) - mock_check_arc.assert_called_once_with(cmd, 'rg', 'vm') - mock_check_az_vm.assert_called_once_with(cmd, 'rg', 'vm') - - def test_assert_args_no_ip_or_id_or_vm(self): - self.assertRaises(azclierror.RequiredArgumentMissingError, custom._assert_args, None, None, None, None, None, None) + mock_assert.assert_called_once_with("rg", "vm", None) + mock_check_files.assert_called_once_with("publicfile", "privatefile") + mock_ip.assert_called_once_with(cmd, "rg", "vm", False) + + def test_assert_args_no_ip_or_vm(self): + self.assertRaises(azclierror.RequiredArgumentMissingError, custom._assert_args, None, None, None) def test_assert_args_vm_rg_mismatch(self): - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", None, None, None, None, None) - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, "vm", None, None, None, None) + self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", None, None) + self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, "vm", None) def test_assert_args_ip_with_vm_or_rg(self): - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, "vm", "ip", None, None, None) - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", None, "ip", None, None, None) - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", "vm", "ip", None, None, None) - - def test_assert_args_id_with_vm_or_rg(self): - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, "vm", None, "id", None, None) - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", None, None, "id", None, None) - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", "vm", None, "id", None, None) - - def test_assert_args_id_with_ip(self): - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, None, "ip", "id", None, None) - - def test_assert_args_cert_with_no_user(self): - self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, None, "ip", None, "certificate", None) - - @mock.patch('os.path.isfile') - def test_assert_args_invalid_cert_filepath(self, mock_is_file): - mock_is_file.return_value = False - self.assertRaises(azclierror.FileOperationError, custom._assert_args, 'rg', 'vm', None, None, 'cert_path', 'username') + self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, None, "vm", "ip") + self.assertRaises(azclierror.MutuallyExclusiveArgumentError, custom._assert_args, "rg", "vm", "ip") @mock.patch('azext_ssh.ssh_utils.create_ssh_keyfile') @mock.patch('tempfile.mkdtemp') @@ -288,7 +157,7 @@ def test_write_cert_file(self, mock_open): mock_open.assert_called_once_with("publickey-aadcert.pub", 'w') mock_file.write.assert_called_once_with("ssh-rsa-cert-v01@openssh.com cert") - + @mock.patch('azext_ssh.rsa_parser.RSAParser') @mock.patch('os.path.isfile') @mock.patch('builtins.open') @@ -323,111 +192,6 @@ def test_get_modulus_exponent_parse_error(self, mock_open, mock_isfile, mock_par self.assertRaises(azclierror.FileOperationError, custom._get_modulus_exponent, 'file') - @mock.patch('azext_ssh.ip_utils.get_ssh_ip') - @mock.patch('azext_ssh.ssh_utils.start_ssh_connection') - @mock.patch('azext_ssh.custom._check_or_create_public_private_files') - @mock.patch('azext_ssh.custom._get_and_write_certificate') - @mock.patch('azext_ssh.custom._arc_get_client_side_proxy') - @mock.patch('azext_ssh.custom._arc_list_access_details') - def test_do_ssh_op_ip_and_local_user_compute(self, mock_get_access, mock_get_proxy, mock_get_cert, mock_check_keys, mock_start_ssh, mock_get_ip): - cmd = mock.Mock() - custom._do_ssh_op(cmd, 'ip', 'public', 'private', 'user', 'cert', 'port', 'False', None, None, mock_start_ssh, False) - mock_get_ip.assert_not_called() - mock_get_cert.assert_not_called() - mock_check_keys.assert_not_called() - mock_get_access.assert_not_called() - mock_get_proxy.assert_not_called() - mock_start_ssh.assert_called_once_with(None, None, None, 'ip', 'user', 'cert', 'private', 'port', False) - - @mock.patch('azext_ssh.ip_utils.get_ssh_ip') - def test_do_ssh_op_with_no_ip(self, mock_get_ip): - cmd = mock.Mock() - mock_get_ip.return_value = None - self.assertRaises( - azclierror.ResourceNotFoundError, custom._do_ssh_op, cmd, None, 'public', 'private', 'user', 'cert', 'port', False, 'rg', 'vm', 'op_call', False) - mock_get_ip.assert_called_once_with(cmd, 'rg', 'vm', False) - - @mock.patch('azext_ssh.ssh_utils.get_ssh_cert_principals') - @mock.patch('os.path.join') - @mock.patch('azext_ssh.custom._check_or_create_public_private_files') - @mock.patch('azext_ssh.ip_utils.get_ssh_ip') - @mock.patch('azext_ssh.custom._get_modulus_exponent') - @mock.patch('azure.cli.core._profile.Profile') - @mock.patch('azext_ssh.custom._write_cert_file') - @mock.patch('azext_ssh.ssh_utils.start_ssh_connection') - def test_do_ssh_op_rg_and_vm_and_aad_user(self, mock_start_ssh, mock_write_cert, mock_ssh_creds, mock_get_mod_exp, mock_ip, mock_check_files, - mock_join, mock_principal): - cmd = mock.Mock() - cmd.cli_ctx = mock.Mock() - cmd.cli_ctx.cloud = mock.Mock() - cmd.cli_ctx.cloud.name = "azurecloud" - mock_check_files.return_value = "public", "private" - mock_principal.return_value = ["username"] - mock_get_mod_exp.return_value = "modulus", "exponent" - profile = mock_ssh_creds.return_value - profile._adal_cache = True - profile.get_msal_token.return_value = "username", "certificate" - mock_join.return_value = "public-aadcert.pub" - mock_ip.return_value = 'ip' - - custom._do_ssh_op(cmd, None, "publicfile", "privatefile", None, None, "port", False, "rg", "vm", mock_start_ssh, False) - - mock_check_files.assert_called_once_with("publicfile", "privatefile") - mock_ip.assert_called_once_with(cmd, 'rg', 'vm', False) - mock_get_mod_exp.assert_called_once_with("public") - mock_write_cert.assert_called_once_with("certificate", "public-aadcert.pub") - mock_start_ssh.assert_called_once_with(None, None, 'vm', 'ip', 'username', 'public-aadcert.pub', 'private', 'port', False) - - @mock.patch('azext_ssh.custom._arc_get_client_side_proxy') - @mock.patch('azext_ssh.custom._arc_list_access_details') - @mock.patch('azext_ssh.ssh_utils.start_ssh_connection') - @mock.patch('azext_ssh.custom._check_or_create_public_private_files') - @mock.patch('azext_ssh.custom._get_and_write_certificate') - def test_do_ssh_arc_op_local_user(self, mock_get_cert, mock_check_keys, mock_start_ssh, mock_get_relay_info, mock_get_proxy): - cmd = mock.Mock() - mock_get_proxy.return_value = '/path/to/proxy' - mock_get_relay_info.return_value = 'relay' - custom._do_ssh_op(cmd, None, 'public', 'private', 'user', 'cert', 'port', False, 'rg', 'vm', mock_start_ssh, True) - mock_get_proxy.assert_called_once_with() - mock_get_relay_info.assert_called_once_with(cmd, 'rg', 'vm') - mock_start_ssh.assert_called_once_with('relay', '/path/to/proxy', 'vm', None, 'user', 'cert', 'private', 'port', True) - mock_get_cert.assert_not_called() - mock_check_keys.assert_not_called() - - @mock.patch('azext_ssh.custom._arc_get_client_side_proxy') - @mock.patch('azext_ssh.custom._arc_list_access_details') - @mock.patch('azext_ssh.ssh_utils.get_ssh_cert_principals') - @mock.patch('os.path.join') - @mock.patch('azext_ssh.custom._check_or_create_public_private_files') - @mock.patch('azext_ssh.custom._get_modulus_exponent') - @mock.patch('azure.cli.core._profile.Profile') - @mock.patch('azext_ssh.custom._write_cert_file') - @mock.patch('azext_ssh.ssh_utils.start_ssh_connection') - def test_do_ssh_arc_op_aad_user(self, mock_start_ssh, mock_write_cert, mock_ssh_creds, mock_get_mod_exp, mock_check_files, - mock_join, mock_principal, mock_get_relay_info, mock_get_proxy): - - mock_get_proxy.return_value = '/path/to/proxy' - mock_get_relay_info.return_value = 'relay' - cmd = mock.Mock() - cmd.cli_ctx = mock.Mock() - cmd.cli_ctx.cloud = mock.Mock() - cmd.cli_ctx.cloud.name = "azurecloud" - mock_check_files.return_value = "public", "private" - mock_principal.return_value = ["username"] - mock_get_mod_exp.return_value = "modulus", "exponent" - profile = mock_ssh_creds.return_value - profile._adal_cache = True - profile.get_msal_token.return_value = "username", "certificate" - mock_join.return_value = "public-aadcert.pub" - - custom._do_ssh_op(cmd, None, 'publicfile', 'privatefile', None, None, 'port', False, 'rg', 'vm', mock_start_ssh, True) - - mock_check_files.assert_called_once_with("publicfile", "privatefile") - mock_get_mod_exp.assert_called_once_with("public") - mock_write_cert.assert_called_once_with("certificate", "public-aadcert.pub") - mock_get_proxy.assert_called_once_with() - mock_get_relay_info.assert_called_once_with(cmd, 'rg', 'vm') - mock_start_ssh.assert_called_once_with('relay', '/path/to/proxy', 'vm', None, 'username', 'public-aadcert.pub', 'private', 'port', True) - if __name__ == '__main__': - unittest.main() +if __name__ == '__main__': + unittest.main() diff --git a/src/ssh/azext_ssh/tests/latest/test_ssh_utils.py b/src/ssh/azext_ssh/tests/latest/test_ssh_utils.py index 978be59939c..5171dd662fc 100644 --- a/src/ssh/azext_ssh/tests/latest/test_ssh_utils.py +++ b/src/ssh/azext_ssh/tests/latest/test_ssh_utils.py @@ -7,211 +7,87 @@ from unittest import mock import unittest import platform -import os - from azext_ssh import ssh_utils class SSHUtilsTests(unittest.TestCase): - - @mock.patch.object(ssh_utils, '_do_cleanup') @mock.patch.object(ssh_utils, '_get_ssh_path') @mock.patch.object(ssh_utils, '_get_host') @mock.patch.object(ssh_utils, '_build_args') @mock.patch('subprocess.call') - @mock.patch('os.environ.copy') - def test_start_ssh_connection_cert_azurevm(self, mock_copy_env, mock_call, mock_build, mock_host, mock_path, mock_cleanup): - mock_path.return_value = 'ssh' - mock_host.return_value = 'user@ip' - mock_build.return_value = ['-i', 'file', '-o', 'option', '-p', 'port'] - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - expected_command = ['ssh', 'user@ip', '-i', 'file', '-o', 'option', '-p', 'port', 'arg1', 'arg2', 'arg3'] - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3'} + def test_start_ssh_connection(self, mock_call, mock_build, mock_host, mock_path): + mock_path.return_value = "ssh" + mock_host.return_value = "user@ip" + mock_build.return_value = ['-i', 'file', '-o', 'option'] + expected_command = ["ssh", "user@ip", "-i", "file", "-o", "option"] - ssh_utils.start_ssh_connection(None, None, 'vm', 'ip', 'user', 'cert', 'private', 'port', False, None, ['arg1', 'arg2', 'arg3'], False) + ssh_utils.start_ssh_connection(None, None, "ip", "user", "cert", "private") mock_path.assert_called_once_with() - mock_host.assert_called_once_with('user', 'ip') - mock_build.assert_called_once_with('cert', 'private', 'port') - mock_cleanup.assert_not_called() - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_get_host') - @mock.patch.object(ssh_utils, '_build_args') - @mock.patch('subprocess.call') - @mock.patch('os.environ.copy') - def test_start_ssh_connection_private_key_azurevm(self, mock_copy_env, mock_call, mock_build, mock_host, mock_path, mock_cleanup): - mock_host.return_value = 'user@ip' - mock_build.return_value = ["-i", "private", "-p", "port"] - expected_command = ["path", "user@ip", "-i", "private", "-p", "port"] - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - - ssh_utils.start_ssh_connection(None, None, 'vm', 'ip', 'user', None, 'private', 'port', False, 'path', None ,False) - - mock_build.assert_called_once_with(None, "private", "port") - mock_path.assert_not_called() mock_host.assert_called_once_with("user", "ip") - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_get_host') - @mock.patch.object(ssh_utils, '_build_args') - @mock.patch('subprocess.call') - @mock.patch('os.environ.copy') - def test_start_ssh_connection_cert_no_private_key_azurevm(self, mock_copy_env, mock_call, mock_build, mock_host, mock_path, mock_cleanup): - mock_path.return_value = 'ssh' - mock_host.return_value = 'user@ip' - mock_build.return_value = ['-o', 'option'] - expected_command = ['ssh', 'user@ip', '-o', 'option', 'arg1', 'arg2', 'arg3'] - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - - ssh_utils.start_ssh_connection(None, None, 'vm', 'ip', 'user', 'cert', None, None, False, None, ['arg1', 'arg2', 'arg3'], False) - - mock_build.assert_called_once_with('cert', None, None) - mock_path.assert_called_once_with() - mock_host.assert_called_once_with('user', 'ip') - mock_cleanup.assert_not_called() - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_get_host') - @mock.patch.object(ssh_utils, '_build_args') - @mock.patch('subprocess.call') - @mock.patch('os.environ.copy') - def test_start_ssh_connection_password_azurevm(self, mock_copy_env, mock_call, mock_build, mock_host, mock_path, mock_cleanup): - mock_path.return_value = 'ssh' - mock_host.return_value = 'user@ip' - mock_build.return_value = ['-p', 'port'] - expected_command = ['ssh', 'user@ip', '-p', 'port'] - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - - ssh_utils.start_ssh_connection(None, None, 'vm', 'ip', 'user', None, None, 'port', False, None, None, False) + mock_build.assert_called_once_with("cert", "private", None) + mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows') - mock_build.assert_called_once_with(None, None, 'port') - mock_path.assert_called_once_with() - mock_host.assert_called_once_with('user', 'ip') - mock_cleanup.assert_not_called() - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch('os.environ.copy') @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_build_args') - @mock.patch('subprocess.call') @mock.patch.object(ssh_utils, '_get_host') - def test_start_ssh_connection_cert_arc(self, mock_host, mock_call, mock_build, mock_path, mock_copy_env, mock_cleanup): - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - mock_path.return_value = 'ssh' - mock_build.return_value = ['-i', 'private', '-o', 'option'] - mock_host.return_value = 'user@vm' - expected_command = ['ssh', 'user@vm', '-o', 'ProxyCommand=/path/to/proxy -p port', '-i', 'private', '-o', 'option'] - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3', 'SSHPROXY_RELAY_INFO':'relay'} - - ssh_utils.start_ssh_connection('relay', '/path/to/proxy', 'vm', None, 'user', 'cert', 'private', 'port', True, None, None, False) - - mock_path.assert_called_once_with() - mock_build.assert_called_once_with('cert', 'private', None) - mock_cleanup.assert_not_called() - mock_host.assert_called_once_with('user', 'vm') - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch('os.environ.copy') - @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_build_args') @mock.patch('subprocess.call') - @mock.patch.object(ssh_utils, '_get_host') - def test_start_ssh_connection_private_key_arc(self, mock_host, mock_call, mock_build, mock_path, mock_copy_env, mock_cleanup): - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - mock_build.return_value = ['-i', 'private'] - expected_command = ['path', 'user@vm', '-o', 'ProxyCommand=/path/to/proxy', '-i', 'private', 'arg1', 'arg2', 'arg3'] - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3', 'SSHPROXY_RELAY_INFO':'relay'} - mock_host.return_value = 'user@vm' - - ssh_utils.start_ssh_connection('relay', '/path/to/proxy', 'vm', None, 'user', None, 'private', None, True, 'path', ['arg1', 'arg2', 'arg3'], False) + def test_start_ssh_connection_with_args(self, mock_call, mock_host, mock_path): + mock_path.return_value = "ssh" + mock_host.return_value = "user@ip" - mock_path.assert_not_called() - mock_host.assert_called_once_with('user', 'vm') - mock_build.assert_called_once_with(None, 'private', None) - mock_cleanup.assert_not_called() - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) - - @mock.patch.object(ssh_utils, '_do_cleanup') - @mock.patch('os.environ.copy') - @mock.patch.object(ssh_utils, '_get_ssh_path') - @mock.patch.object(ssh_utils, '_build_args') - @mock.patch('subprocess.call') - @mock.patch.object(ssh_utils, '_get_host') - def test_start_ssh_connection_cert_no_private_key_arc(self, mock_host, mock_call, mock_build, mock_path, mock_copy_env, mock_cleanup): - mock_copy_env.return_value = {'var1':'value1', 'var2':'value2', 'var3':'value3'} - mock_path.return_value = 'ssh' - mock_build.return_value = ['-o', 'option'] - expected_command = ['ssh', 'user@vm', '-o', 'ProxyCommand=/path/to/proxy -p port', '-o', 'option', 'arg1', 'arg2'] - expected_env = {'var1':'value1', 'var2':'value2', 'var3':'value3', 'SSHPROXY_RELAY_INFO':'relay'} - mock_host.return_value = 'user@vm' + expected_command = ["ssh", "user@ip", "-i", "private", "-o", "CertificateFile=cert", "-p", "2222", "--thing"] - ssh_utils.start_ssh_connection('relay', '/path/to/proxy', 'vm', None, 'user', 'cert', None, 'port', True, None, ['arg1', 'arg2'], False) + ssh_utils.start_ssh_connection("2222", ["--thing"], "ip", "user", "cert", "private") mock_path.assert_called_once_with() - mock_build.assert_called_once_with('cert', None, None) - mock_host.assert_called_once_with('user', 'vm') - mock_cleanup.assert_not_called() - mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows', env=expected_env) + mock_host.assert_called_once_with("user", "ip") + mock_call.assert_called_once_with(expected_command, shell=platform.system() == 'Windows') - def test_write_ssh_config_ip_and_vm_azurevm(self): + def test_write_ssh_config_ip_and_vm(self): expected_lines = [ "", "Host rg-vm", - "\tHostName 1.2.3.4", "\tUser username", + "\tHostName 1.2.3.4", "\tCertificateFile cert", "\tIdentityFile privatekey", - "\tPort port", "Host 1.2.3.4", "\tUser username", "\tCertificateFile cert", - "\tIdentityFile privatekey", - "\tPort port" + "\tIdentityFile privatekey" ] with mock.patch('builtins.open') as mock_open: mock_file = mock.Mock() mock_open.return_value.__enter__.return_value = mock_file ssh_utils.write_ssh_config( - None, None, 'vm', '1.2.3.4', 'username', 'cert', 'privatekey', 'port', False, 'path/to/file', True, 'rg') + "path/to/file", "rg", "vm", True, "1.2.3.4", "username", "cert", "privatekey" + ) mock_open.assert_called_once_with("path/to/file", "w") mock_file.write.assert_called_once_with('\n'.join(expected_lines)) - - def test_write_ssh_config_append_azurevm(self): + + def test_write_ssh_config_append(self): expected_lines = [ "", "Host rg-vm", - "\tHostName 1.2.3.4", "\tUser username", + "\tHostName 1.2.3.4", "\tCertificateFile cert", "\tIdentityFile privatekey", - "\tPort port", "Host 1.2.3.4", "\tUser username", "\tCertificateFile cert", - "\tIdentityFile privatekey", - "\tPort port" + "\tIdentityFile privatekey" ] with mock.patch('builtins.open') as mock_open: mock_file = mock.Mock() mock_open.return_value.__enter__.return_value = mock_file ssh_utils.write_ssh_config( - None, None, 'vm', '1.2.3.4', 'username', 'cert', 'privatekey', 'port', False, 'path/to/file', False, 'rg') + "path/to/file", "rg", "vm", False, "1.2.3.4", "username", "cert", "privatekey" + ) mock_open.assert_called_once_with("path/to/file", "a") mock_file.write.assert_called_once_with('\n'.join(expected_lines)) @@ -222,73 +98,19 @@ def test_write_ssh_config_ip_only(self): "Host 1.2.3.4", "\tUser username", "\tCertificateFile cert", - "\tIdentityFile privatekey", - "\tPort port" + "\tIdentityFile privatekey" ] with mock.patch('builtins.open') as mock_open: mock_file = mock.Mock() mock_open.return_value.__enter__.return_value = mock_file ssh_utils.write_ssh_config( - None, None, None, '1.2.3.4', 'username', 'cert', 'privatekey', 'port', False, 'path/to/file', True, None) + "path/to/file", None, None, True, "1.2.3.4", "username", "cert", "privatekey" + ) mock_open.assert_called_once_with("path/to/file", "w") mock_file.write.assert_called_once_with('\n'.join(expected_lines)) - - @mock.patch('os.path.dirname') - @mock.patch('oschmod.set_mode') - @mock.patch('azext_ssh.file_utils.write_to_file') - def test_write_ssh_config_append_arc(self, mock_write, mock_set_mode, mock_dirname): - import stat - expected_lines = [ - "", - "Host rg-vm", - "\tUser username", - "\tCertificateFile cert", - "\tIdentityFile privatekey", - "\tProxyCommand /path/to/proxy -r /path/to/relay_info -p port" - ] - - with mock.patch('builtins.open') as mock_open: - mock_file = mock.Mock() - mock_open.return_value.__enter__.return_value = mock_file - mock_dirname.return_value = '/path/to/' - ssh_utils.write_ssh_config( - 'relay_info', '/path/to/proxy', 'vm', None, 'username', 'cert', 'privatekey', 'port', True, 'path/to/file', False, 'rg' - ) - - mock_write.assert_called_once_with('/path/to/relay_info', 'w', 'relay_info', "Couldn't write relay information to file /path/to/relay_info", 'utf-8') - mock_open.assert_called_once_with("path/to/file", "a") - mock_file.write.assert_called_with('\n'.join(expected_lines)) - mock_set_mode.assert_called_once_with("/path/to/relay_info", stat.S_IRUSR) - - @mock.patch('os.path.dirname') - @mock.patch('oschmod.set_mode') - @mock.patch('azext_ssh.file_utils.write_to_file') - def test_write_ssh_config_overwrite_arc(self, mock_write, mock_set_mode, mock_dirname): - import stat - expected_lines = [ - "", - "Host rg-vm", - "\tUser username", - "\tCertificateFile cert", - "\tIdentityFile privatekey", - "\tProxyCommand /path/to/proxy -r /path/to/relay_info -p port" - ] - with mock.patch('builtins.open') as mock_open: - mock_file = mock.Mock() - mock_open.return_value.__enter__.return_value = mock_file - mock_dirname.return_value = '/path/to/' - ssh_utils.write_ssh_config( - 'relay_info', '/path/to/proxy', 'vm', None, 'username', 'cert', 'privatekey', 'port', True, 'path/to/file', True, 'rg' - ) - - mock_write.assert_called_once_with('/path/to/relay_info', 'w', 'relay_info', "Couldn't write relay information to file /path/to/relay_info", 'utf-8') - mock_open.assert_any_call("path/to/file", "w") - mock_file.write.assert_called_with('\n'.join(expected_lines)) - mock_set_mode.assert_called_once_with("/path/to/relay_info", stat.S_IRUSR) - @mock.patch('platform.system') def test_get_ssh_path_non_windows(self, mock_system): mock_system.return_value = "Mac" @@ -348,18 +170,3 @@ def _test_ssh_path_windows(self, arch, expected_sys_path, mock_isfile, mock_envi mock_environ.__getitem__.assert_called_once_with("SystemRoot") mock_join.assert_has_calls(expected_join_calls) mock_isfile.assert_called_once_with("sshfilepath") - - @mock.patch('os.environ.get') - def test_do_cleanup_not_cloudshell(self, mock_getenv): - mock_getenv.return_value = None - self.assertRaises( - azclierror.BadRequestError, ssh_utils._do_cleanup, 'private', 'cert', None) - - @mock.patch('os.path.isfile') - @mock.patch('os.remove') - @mock.patch('os.environ.get') - def test_do_cleanup_cloudshell(self, mock_getenv, mock_remove, mock_isfile): - mock_isfile.return_value = True - mock_getenv.return_value = "cloud-shell/1.0" - ssh_utils._do_cleanup('private', 'cert', None) - mock_remove.assert_has_calls([mock.call('private'), mock.call('cert')]) diff --git a/src/ssh/azext_ssh/vendored_sdks/__init__.py b/src/ssh/azext_ssh/vendored_sdks/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/__init__.py +++ /dev/null @@ -1,12 +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. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/__init__.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/__init__.py deleted file mode 100644 index 35ef17cd924..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/__init__.py +++ /dev/null @@ -1,16 +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 ._connected_machine import ConnectedMachine -__all__ = ['ConnectedMachine'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_configuration.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_configuration.py deleted file mode 100644 index a369296810e..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_configuration.py +++ /dev/null @@ -1,70 +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 typing import TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import TokenCredential - -VERSION = "unknown" - -class ConnectedMachineConfiguration(Configuration): - """Configuration for ConnectedMachine. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(ConnectedMachineConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-06-10-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'connectedmachine/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or 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) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_connected_machine.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_connected_machine.py deleted file mode 100644 index a740f6f0196..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/_connected_machine.py +++ /dev/null @@ -1,95 +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 typing import TYPE_CHECKING - -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - -from ._configuration import ConnectedMachineConfiguration -from .operations import MachinesOperations -from .operations import MachineExtensionsOperations -from .operations import ConnectedMachineOperationsMixin -from .operations import Operations -from .operations import PrivateLinkScopesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from . import models - - -class ConnectedMachine(ConnectedMachineOperationsMixin): - """The Hybrid Compute Management Client. - - :ivar machines: MachinesOperations operations - :vartype machines: connected_machine.operations.MachinesOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: connected_machine.operations.MachineExtensionsOperations - :ivar operations: Operations operations - :vartype operations: connected_machine.operations.Operations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: connected_machine.operations.PrivateLinkScopesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: connected_machine.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: connected_machine.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. - :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__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ConnectedMachineConfiguration(credential, subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.machines = MachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.machine_extensions = MachineExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_scopes = PrivateLinkScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> ConnectedMachine - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/__init__.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/__init__.py deleted file mode 100644 index 5a8f3eca2b2..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/__init__.py +++ /dev/null @@ -1,10 +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 ._connected_machine import ConnectedMachine -__all__ = ['ConnectedMachine'] diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_configuration.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_configuration.py deleted file mode 100644 index 248e7a48540..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_configuration.py +++ /dev/null @@ -1,66 +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 typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -VERSION = "unknown" - -class ConnectedMachineConfiguration(Configuration): - """Configuration for ConnectedMachine. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(ConnectedMachineConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2021-06-10-preview" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'connectedmachine/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or 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) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_connected_machine.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_connected_machine.py deleted file mode 100644 index 5eea54c2534..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/_connected_machine.py +++ /dev/null @@ -1,89 +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 typing import Any, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration import ConnectedMachineConfiguration -from .operations import MachinesOperations -from .operations import MachineExtensionsOperations -from .operations import ConnectedMachineOperationsMixin -from .operations import Operations -from .operations import PrivateLinkScopesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .. import models - - -class ConnectedMachine(ConnectedMachineOperationsMixin): - """The Hybrid Compute Management Client. - - :ivar machines: MachinesOperations operations - :vartype machines: connected_machine.aio.operations.MachinesOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: connected_machine.aio.operations.MachineExtensionsOperations - :ivar operations: Operations operations - :vartype operations: connected_machine.aio.operations.Operations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: connected_machine.aio.operations.PrivateLinkScopesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: connected_machine.aio.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: connected_machine.aio.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :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__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ConnectedMachineConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.machines = MachinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.machine_extensions = MachineExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_scopes = PrivateLinkScopesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ConnectedMachine": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/__init__.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/__init__.py deleted file mode 100644 index 641a5a8b66c..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._machines_operations import MachinesOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._connected_machine_operations import ConnectedMachineOperationsMixin -from ._operations import Operations -from ._private_link_scopes_operations import PrivateLinkScopesOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations - -__all__ = [ - 'MachinesOperations', - 'MachineExtensionsOperations', - 'ConnectedMachineOperationsMixin', - 'Operations', - 'PrivateLinkScopesOperations', - 'PrivateLinkResourcesOperations', - 'PrivateEndpointConnectionsOperations', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_connected_machine_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_connected_machine_operations.py deleted file mode 100644 index 67684c5203e..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_connected_machine_operations.py +++ /dev/null @@ -1,142 +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 typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -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 AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ConnectedMachineOperationsMixin: - - async def _upgrade_extensions_initial( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: "models.MachineExtensionUpgrade", - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._upgrade_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_upgrade_parameters, 'MachineExtensionUpgrade') - 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 - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _upgrade_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions'} # type: ignore - - async def begin_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: "models.MachineExtensionUpgrade", - **kwargs - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - :type extension_upgrade_parameters: ~connected_machine.models.MachineExtensionUpgrade - :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 - :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] - 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._upgrade_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_upgrade_parameters=extension_upgrade_parameters, - 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, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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 - 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_upgrade_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machine_extensions_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machine_extensions_operations.py deleted file mode 100644 index 8ff9c9cc8ff..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,571 +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 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 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 AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MachineExtensionsOperations: - """MachineExtensionsOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: "models.MachineExtension", - **kwargs - ) -> Optional["models.MachineExtension"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MachineExtension"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'MachineExtension') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: "models.MachineExtension", - **kwargs - ) -> AsyncLROPoller["models.MachineExtension"]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - :type extension_parameters: ~connected_machine.models.MachineExtension - :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 - :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 MachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~connected_machine.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - 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_or_update_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - 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('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: "models.MachineExtensionUpdate", - **kwargs - ) -> Optional["models.MachineExtension"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MachineExtension"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'MachineExtensionUpdate') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def begin_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: "models.MachineExtensionUpdate", - **kwargs - ) -> AsyncLROPoller["models.MachineExtension"]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - :type extension_parameters: ~connected_machine.models.MachineExtensionUpdate - :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 - :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 MachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~connected_machine.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - 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._update_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - 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('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be deleted. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_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 - :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] - 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( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - async def get( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - **kwargs - ) -> "models.MachineExtension": - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension, or the result of cls(response) - :rtype: ~connected_machine.models.MachineExtension - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def list( - self, - resource_group_name: str, - machine_name: str, - expand: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.MachineExtensionsListResult"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. - :type machine_name: str - :param expand: The expand expression to apply on the operation. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.MachineExtensionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtensionsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('MachineExtensionsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machines_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machines_operations.py deleted file mode 100644 index ca11a2e9b14..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_machines_operations.py +++ /dev/null @@ -1,494 +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 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 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 - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MachinesOperations: - """MachinesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list_access_details( - self, - resource_group_name: str, - machine_name: str, - **kwargs - ) -> str: - """The operation to create or update a hybrid machine resource identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: str, or the result of cls(response) - :rtype: str - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.list_access_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('str', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_access_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/listAccessDetails'} # type: ignore - - async def create_or_update( - self, - resource_group_name: str, - machine_name: str, - parameters: "models.Machine", - **kwargs - ) -> "models.Machine": - """The operation to create or update a hybrid machine resource identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param parameters: Parameters supplied to the Create hybrid machine operation. - :type parameters: ~connected_machine.models.Machine - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Machine') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - machine_name: str, - parameters: "models.MachineUpdate", - **kwargs - ) -> "models.Machine": - """The operation to update a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param parameters: Parameters supplied to the Update hybrid machine operation. - :type parameters: ~connected_machine.models.MachineUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MachineUpdate') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - async def delete( - self, - resource_group_name: str, - machine_name: str, - **kwargs - ) -> None: - """The operation to remove a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - async def get( - self, - resource_group_name: str, - machine_name: str, - expand: Optional[Union[str, "models.InstanceViewTypes"]] = None, - **kwargs - ) -> "models.Machine": - """Retrieves information about the model view or the instance view of a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param expand: The expand expression to apply on the operation. - :type expand: str or ~connected_machine.models.InstanceViewTypes - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.MachineListResult"]: - """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the - response to get the next page of hybrid machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.MachineListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('MachineListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines'} # type: ignore - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.MachineListResult"]: - """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the - response to get the next page of hybrid machines. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.MachineListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('MachineListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_operations.py deleted file mode 100644 index eb7be25ef1f..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_operations.py +++ /dev/null @@ -1,105 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -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 - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.OperationListResult"]: - """Gets a list of hybrid compute operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.HybridCompute/operations'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_endpoint_connections_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index c4a9770a927..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,432 +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 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 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 AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - **kwargs - ) -> "models.PrivateEndpointConnection": - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnection", - **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: "models.PrivateEndpointConnection", - **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_name: str - :param parameters: - :type parameters: ~connected_machine.models.PrivateEndpointConnection - :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 - :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~connected_machine.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - 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_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - 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('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 - 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_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 - :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] - 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( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 - 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.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def list_by_private_link_scope( - self, - resource_group_name: str, - scope_name: str, - **kwargs - ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_private_link_scope.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_resources_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index b474778b42e..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,180 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -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 - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_private_link_scope( - self, - resource_group_name: str, - scope_name: str, - **kwargs - ) -> AsyncIterable["models.PrivateLinkResourceListResult"]: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_private_link_scope.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources'} # type: ignore - - async def get( - self, - resource_group_name: str, - scope_name: str, - group_name: str, - **kwargs - ) -> "models.PrivateLinkResource": - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param group_name: The name of the private link resource. - :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'groupName': self._serialize.url("group_name", 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_scopes_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_scopes_operations.py deleted file mode 100644 index b906775b085..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/aio/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,611 +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 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 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 AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PrivateLinkScopesOperations: - """PrivateLinkScopesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.HybridComputePrivateLinkScopeListResult"]: - """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridComputePrivateLinkScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.HybridComputePrivateLinkScopeListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScopeListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('HybridComputePrivateLinkScopeListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.HybridComputePrivateLinkScopeListResult"]: - """Gets a list of Azure Arc PrivateLinkScopes within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridComputePrivateLinkScopeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~connected_machine.models.HybridComputePrivateLinkScopeListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScopeListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('HybridComputePrivateLinkScopeListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - scope_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - scope_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_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 - :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] - 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( - resource_group_name=resource_group_name, - scope_name=scope_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, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - 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.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - async def get( - self, - resource_group_name: str, - scope_name: str, - **kwargs - ) -> "models.HybridComputePrivateLinkScope": - """Returns a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: "models.HybridComputePrivateLinkScope", - **kwargs - ) -> "models.HybridComputePrivateLinkScope": - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. - :type parameters: ~connected_machine.models.HybridComputePrivateLinkScope - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'HybridComputePrivateLinkScope') - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: "models.TagsResource", - **kwargs - ) -> "models.HybridComputePrivateLinkScope": - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. - :type private_link_scope_tags: ~connected_machine.models.TagsResource - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_scope_tags, 'TagsResource') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - async def get_validation_details( - self, - location: str, - private_link_scope_id: str, - **kwargs - ) -> "models.PrivateLinkScopeValidationDetails": - """Returns a Azure Arc PrivateLinkScope's validation details. - - :param location: The location of the target resource. - :type location: str - :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. - :type private_link_scope_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkScopeValidationDetails, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkScopeValidationDetails - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkScopeValidationDetails"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get_validation_details.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str', min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateLinkScopeId': self._serialize.url("private_link_scope_id", private_link_scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkScopeValidationDetails', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_validation_details.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId}'} # type: ignore - - async def get_validation_details_for_machine( - self, - resource_group_name: str, - machine_name: str, - **kwargs - ) -> "models.PrivateLinkScopeValidationDetails": - """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the target machine to get the private link scope validation - details for. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkScopeValidationDetails, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkScopeValidationDetails - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkScopeValidationDetails"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get_validation_details_for_machine.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkScopeValidationDetails', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_validation_details_for_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/privateLinkScopes/current'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/__init__.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/__init__.py deleted file mode 100644 index ecac1656673..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/__init__.py +++ /dev/null @@ -1,164 +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. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import ConnectionDetail - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import ExtensionTargetProperties - from ._models_py3 import HybridComputePrivateLinkScope - from ._models_py3 import HybridComputePrivateLinkScopeListResult - from ._models_py3 import HybridComputePrivateLinkScopeProperties - from ._models_py3 import Identity - from ._models_py3 import LocationData - from ._models_py3 import Machine - from ._models_py3 import MachineExtension - from ._models_py3 import MachineExtensionInstanceView - from ._models_py3 import MachineExtensionInstanceViewStatus - from ._models_py3 import MachineExtensionProperties - from ._models_py3 import MachineExtensionUpdate - from ._models_py3 import MachineExtensionUpdateProperties - from ._models_py3 import MachineExtensionUpgrade - from ._models_py3 import MachineExtensionsListResult - from ._models_py3 import MachineListResult - from ._models_py3 import MachineProperties - from ._models_py3 import MachineUpdate - from ._models_py3 import MachineUpdateProperties - from ._models_py3 import OperationListResult - from ._models_py3 import OperationValue - from ._models_py3 import OperationValueDisplay - from ._models_py3 import OsProfile - from ._models_py3 import OsProfileLinuxConfiguration - from ._models_py3 import OsProfileWindowsConfiguration - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionDataModel - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateEndpointConnectionProperties - from ._models_py3 import PrivateEndpointProperty - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkResourceProperties - from ._models_py3 import PrivateLinkScopeValidationDetails - from ._models_py3 import PrivateLinkScopesResource - from ._models_py3 import PrivateLinkServiceConnectionStateProperty - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceUpdate - from ._models_py3 import SystemData - from ._models_py3 import TagsResource - from ._models_py3 import TrackedResource -except (SyntaxError, ImportError): - from ._models import ConnectionDetail # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExtensionTargetProperties # type: ignore - from ._models import HybridComputePrivateLinkScope # type: ignore - from ._models import HybridComputePrivateLinkScopeListResult # type: ignore - from ._models import HybridComputePrivateLinkScopeProperties # type: ignore - from ._models import Identity # type: ignore - from ._models import LocationData # type: ignore - from ._models import Machine # type: ignore - from ._models import MachineExtension # type: ignore - from ._models import MachineExtensionInstanceView # type: ignore - from ._models import MachineExtensionInstanceViewStatus # type: ignore - from ._models import MachineExtensionProperties # type: ignore - from ._models import MachineExtensionUpdate # type: ignore - from ._models import MachineExtensionUpdateProperties # type: ignore - from ._models import MachineExtensionUpgrade # type: ignore - from ._models import MachineExtensionsListResult # type: ignore - from ._models import MachineListResult # type: ignore - from ._models import MachineProperties # type: ignore - from ._models import MachineUpdate # type: ignore - from ._models import MachineUpdateProperties # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationValue # type: ignore - from ._models import OperationValueDisplay # type: ignore - from ._models import OsProfile # type: ignore - from ._models import OsProfileLinuxConfiguration # type: ignore - from ._models import OsProfileWindowsConfiguration # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionDataModel # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateEndpointConnectionProperties # type: ignore - from ._models import PrivateEndpointProperty # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkResourceProperties # type: ignore - from ._models import PrivateLinkScopeValidationDetails # type: ignore - from ._models import PrivateLinkScopesResource # type: ignore - from ._models import PrivateLinkServiceConnectionStateProperty # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceUpdate # type: ignore - from ._models import SystemData # type: ignore - from ._models import TagsResource # type: ignore - from ._models import TrackedResource # type: ignore - -from ._connected_machine_enums import ( - CreatedByType, - InstanceViewTypes, - PublicNetworkAccessType, - StatusLevelTypes, - StatusTypes, -) - -__all__ = [ - 'ConnectionDetail', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'ExtensionTargetProperties', - 'HybridComputePrivateLinkScope', - 'HybridComputePrivateLinkScopeListResult', - 'HybridComputePrivateLinkScopeProperties', - 'Identity', - 'LocationData', - 'Machine', - 'MachineExtension', - 'MachineExtensionInstanceView', - 'MachineExtensionInstanceViewStatus', - 'MachineExtensionProperties', - 'MachineExtensionUpdate', - 'MachineExtensionUpdateProperties', - 'MachineExtensionUpgrade', - 'MachineExtensionsListResult', - 'MachineListResult', - 'MachineProperties', - 'MachineUpdate', - 'MachineUpdateProperties', - 'OperationListResult', - 'OperationValue', - 'OperationValueDisplay', - 'OsProfile', - 'OsProfileLinuxConfiguration', - 'OsProfileWindowsConfiguration', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionDataModel', - 'PrivateEndpointConnectionListResult', - 'PrivateEndpointConnectionProperties', - 'PrivateEndpointProperty', - 'PrivateLinkResource', - 'PrivateLinkResourceListResult', - 'PrivateLinkResourceProperties', - 'PrivateLinkScopeValidationDetails', - 'PrivateLinkScopesResource', - 'PrivateLinkServiceConnectionStateProperty', - 'ProxyResource', - 'Resource', - 'ResourceUpdate', - 'SystemData', - 'TagsResource', - 'TrackedResource', - 'CreatedByType', - 'InstanceViewTypes', - 'PublicNetworkAccessType', - 'StatusLevelTypes', - 'StatusTypes', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_connected_machine_enums.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_connected_machine_enums.py deleted file mode 100644 index dec09de8f57..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_connected_machine_enums.py +++ /dev/null @@ -1,64 +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 enum import Enum, EnumMeta -from six import with_metaclass - -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 CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that created the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class InstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - INSTANCE_VIEW = "instanceView" - -class PublicNetworkAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The network access policy to determine if Azure Arc agents can use public Azure Arc service - endpoints. Defaults to disabled (access to Azure Arc services only via private link). - """ - - ENABLED = "Enabled" #: Allows Azure Arc agents to communicate with Azure Arc services over both public (internet) and private endpoints. - DISABLED = "Disabled" #: Does not allow Azure Arc agents to communicate with Azure Arc services over public (internet) endpoints. The agents must use the private link. - -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The level code. - """ - - INFO = "Info" - WARNING = "Warning" - ERROR = "Error" - -class StatusTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The status of the hybrid machine agent. - """ - - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - ERROR = "Error" diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models.py deleted file mode 100644 index 483bb7efb0b..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models.py +++ /dev/null @@ -1,1693 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ConnectionDetail(msrest.serialization.Model): - """ConnectionDetail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar private_ip_address: The private endpoint connection private ip address. - :vartype private_ip_address: str - :ivar link_identifier: The private endpoint connection link identifier. - :vartype link_identifier: str - :ivar group_id: The private endpoint connection group id. - :vartype group_id: str - :ivar member_name: The private endpoint connection member name. - :vartype member_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'private_ip_address': {'readonly': True}, - 'link_identifier': {'readonly': True}, - 'group_id': {'readonly': True}, - 'member_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'link_identifier': {'key': 'linkIdentifier', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'member_name': {'key': 'memberName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionDetail, self).__init__(**kwargs) - self.id = None - self.private_ip_address = None - self.link_identifier = None - self.group_id = None - self.member_name = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~connected_machine.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~connected_machine.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~connected_machine.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ExtensionTargetProperties(msrest.serialization.Model): - """Describes the Machine Extension Target Version Properties. - - :param target_version: Properties for the specified Extension to Upgrade. - :type target_version: str - """ - - _attribute_map = { - 'target_version': {'key': 'targetVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTargetProperties, self).__init__(**kwargs) - self.target_version = kwargs.get('target_version', None) - - -class PrivateLinkScopesResource(msrest.serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkScopesResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class HybridComputePrivateLinkScope(PrivateLinkScopesResource): - """An Azure Arc PrivateLinkScope definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties that define a Azure Arc PrivateLinkScope resource. - :type properties: ~connected_machine.models.HybridComputePrivateLinkScopeProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'HybridComputePrivateLinkScopeProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(HybridComputePrivateLinkScope, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class HybridComputePrivateLinkScopeListResult(msrest.serialization.Model): - """Describes the list of Azure Arc PrivateLinkScope resources. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. List of Azure Arc PrivateLinkScope definitions. - :type value: list[~connected_machine.models.HybridComputePrivateLinkScope] - :param next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if too - many PrivateLinkScopes where returned in the result set. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[HybridComputePrivateLinkScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HybridComputePrivateLinkScopeListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class HybridComputePrivateLinkScopeProperties(msrest.serialization.Model): - """Properties that define a Azure Arc PrivateLinkScope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Possible values include: "Enabled", - "Disabled". Default value: "Disabled". - :type public_network_access: str or ~connected_machine.models.PublicNetworkAccessType - :ivar provisioning_state: Current state of this PrivateLinkScope: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - :vartype provisioning_state: str - :ivar private_link_scope_id: The Guid id of the private link scope. - :vartype private_link_scope_id: str - :ivar private_endpoint_connections: The collection of associated Private Endpoint Connections. - :vartype private_endpoint_connections: - list[~connected_machine.models.PrivateEndpointConnectionDataModel] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'private_link_scope_id': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_link_scope_id': {'key': 'privateLinkScopeId', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionDataModel]'}, - } - - def __init__( - self, - **kwargs - ): - super(HybridComputePrivateLinkScopeProperties, self).__init__(**kwargs) - self.public_network_access = kwargs.get('public_network_access', "Disabled") - self.provisioning_state = None - self.private_link_scope_id = None - self.private_endpoint_connections = None - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Default value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class LocationData(msrest.serialization.Model): - """Metadata pertaining to the geographic location of the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A canonical name for the geographic or physical location. - :type name: str - :param city: The city or locality where the resource is located. - :type city: str - :param district: The district, state, or province where the resource is located. - :type district: str - :param country_or_region: The country or region where the resource is located. - :type country_or_region: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'district': {'key': 'district', 'type': 'str'}, - 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LocationData, self).__init__(**kwargs) - self.name = kwargs['name'] - self.city = kwargs.get('city', None) - self.district = kwargs.get('district', None) - self.country_or_region = kwargs.get('country_or_region', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class Machine(TrackedResource): - """Describes a hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Hybrid Compute Machine properties. - :type properties: ~connected_machine.models.MachineProperties - :param identity: Identity for the resource. - :type identity: ~connected_machine.models.Identity - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MachineProperties'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Machine, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.identity = kwargs.get('identity', None) - self.system_data = None - - -class MachineExtension(TrackedResource): - """Describes a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Describes Machine Extension Properties. - :type properties: ~connected_machine.models.MachineExtensionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MachineExtensionProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtension, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class MachineExtensionInstanceView(msrest.serialization.Model): - """Describes the Machine Extension Instance View. - - :param name: The machine extension name. - :type name: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param status: Instance view status. - :type status: ~connected_machine.models.MachineExtensionInstanceViewStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'MachineExtensionInstanceViewStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionInstanceView, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.type_handler_version = kwargs.get('type_handler_version', None) - self.status = kwargs.get('status', None) - - -class MachineExtensionInstanceViewStatus(msrest.serialization.Model): - """Instance view status. - - :param code: The status code. - :type code: str - :param level: The level code. Possible values include: "Info", "Warning", "Error". - :type level: str or ~connected_machine.models.StatusLevelTypes - :param display_status: The short localizable label for the status. - :type display_status: str - :param message: The detailed status message, including for alerts and error messages. - :type message: str - :param time: The time of the status. - :type time: ~datetime.datetime - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionInstanceViewStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.level = kwargs.get('level', None) - self.display_status = kwargs.get('display_status', None) - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class MachineExtensionProperties(msrest.serialization.Model): - """Describes the properties of a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param instance_view: The machine extension instance view. - :type instance_view: ~connected_machine.models.MachineExtensionInstanceView - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'instanceView', 'type': 'MachineExtensionInstanceView'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionProperties, self).__init__(**kwargs) - self.force_update_tag = kwargs.get('force_update_tag', None) - self.publisher = kwargs.get('publisher', None) - self.type = kwargs.get('type', None) - self.type_handler_version = kwargs.get('type_handler_version', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.provisioning_state = None - self.instance_view = kwargs.get('instance_view', None) - - -class MachineExtensionsListResult(msrest.serialization.Model): - """Describes the Machine Extensions List Result. - - :param value: The list of extensions. - :type value: list[~connected_machine.models.MachineExtension] - :param next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MachineExtension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceUpdate(msrest.serialization.Model): - """The Update Resource model definition. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class MachineExtensionUpdate(ResourceUpdate): - """Describes a Machine Extension Update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Describes Machine Extension Update Properties. - :type properties: ~connected_machine.models.MachineExtensionUpdateProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'MachineExtensionUpdateProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionUpdate, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class MachineExtensionUpdateProperties(msrest.serialization.Model): - """Describes the properties of a Machine Extension. - - :param force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - """ - - _attribute_map = { - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionUpdateProperties, self).__init__(**kwargs) - self.force_update_tag = kwargs.get('force_update_tag', None) - self.publisher = kwargs.get('publisher', None) - self.type = kwargs.get('type', None) - self.type_handler_version = kwargs.get('type_handler_version', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - - -class MachineExtensionUpgrade(msrest.serialization.Model): - """Describes the Machine Extension Upgrade Properties. - - :param extension_targets: Describes the Extension Target Properties. - :type extension_targets: dict[str, ~connected_machine.models.ExtensionTargetProperties] - """ - - _attribute_map = { - 'extension_targets': {'key': 'extensionTargets', 'type': '{ExtensionTargetProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineExtensionUpgrade, self).__init__(**kwargs) - self.extension_targets = kwargs.get('extension_targets', None) - - -class MachineListResult(msrest.serialization.Model): - """The List hybrid machine operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of hybrid machines. - :type value: list[~connected_machine.models.Machine] - :param next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of hybrid machines. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Machine]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class MachineProperties(msrest.serialization.Model): - """Describes the properties of a hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location_data: Metadata pertaining to the geographic location of the resource. - :type location_data: ~connected_machine.models.LocationData - :param os_profile: Specifies the operating system settings for the hybrid machine. - :type os_profile: ~connected_machine.models.OsProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar status: The status of the hybrid machine agent. Possible values include: "Connected", - "Disconnected", "Error". - :vartype status: str or ~connected_machine.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar error_details: Details about the error state. - :vartype error_details: list[~connected_machine.models.ErrorDetail] - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :param vm_id: Specifies the hybrid machine unique ID. - :type vm_id: str - :ivar display_name: Specifies the hybrid machine display name. - :vartype display_name: str - :ivar machine_fqdn: Specifies the hybrid machine FQDN. - :vartype machine_fqdn: str - :param client_public_key: Public Key that the client provides to be used during initial - resource onboarding. - :type client_public_key: str - :ivar os_name: The Operating System running on the hybrid machine. - :vartype os_name: str - :ivar os_version: The version of Operating System running on the hybrid machine. - :vartype os_version: str - :param os_type: The type of Operating System (windows/linux). - :type os_type: str - :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. - :vartype vm_uuid: str - :param extensions: Machine Extensions information. - :type extensions: list[~connected_machine.models.MachineExtensionInstanceView] - :ivar os_sku: Specifies the Operating System product SKU. - :vartype os_sku: str - :ivar domain_name: Specifies the Windows domain name. - :vartype domain_name: str - :ivar ad_fqdn: Specifies the AD fully qualified display name. - :vartype ad_fqdn: str - :ivar dns_fqdn: Specifies the DNS fully qualified display name. - :vartype dns_fqdn: str - :param private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :type private_link_scope_resource_id: str - :param parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :type parent_cluster_resource_id: str - :param mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :type mssql_discovered: str - :ivar detected_properties: Detected properties from the machine. - :vartype detected_properties: dict[str, str] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'last_status_change': {'readonly': True}, - 'error_details': {'readonly': True}, - 'agent_version': {'readonly': True}, - 'display_name': {'readonly': True}, - 'machine_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'os_version': {'readonly': True}, - 'vm_uuid': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'domain_name': {'readonly': True}, - 'ad_fqdn': {'readonly': True}, - 'dns_fqdn': {'readonly': True}, - 'detected_properties': {'readonly': True}, - } - - _attribute_map = { - 'location_data': {'key': 'locationData', 'type': 'LocationData'}, - 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, - 'error_details': {'key': 'errorDetails', 'type': '[ErrorDetail]'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'machine_fqdn': {'key': 'machineFqdn', 'type': 'str'}, - 'client_public_key': {'key': 'clientPublicKey', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_uuid': {'key': 'vmUuid', 'type': 'str'}, - 'extensions': {'key': 'extensions', 'type': '[MachineExtensionInstanceView]'}, - 'os_sku': {'key': 'osSku', 'type': 'str'}, - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'ad_fqdn': {'key': 'adFqdn', 'type': 'str'}, - 'dns_fqdn': {'key': 'dnsFqdn', 'type': 'str'}, - 'private_link_scope_resource_id': {'key': 'privateLinkScopeResourceId', 'type': 'str'}, - 'parent_cluster_resource_id': {'key': 'parentClusterResourceId', 'type': 'str'}, - 'mssql_discovered': {'key': 'mssqlDiscovered', 'type': 'str'}, - 'detected_properties': {'key': 'detectedProperties', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineProperties, self).__init__(**kwargs) - self.location_data = kwargs.get('location_data', None) - self.os_profile = kwargs.get('os_profile', None) - self.provisioning_state = None - self.status = None - self.last_status_change = None - self.error_details = None - self.agent_version = None - self.vm_id = kwargs.get('vm_id', None) - self.display_name = None - self.machine_fqdn = None - self.client_public_key = kwargs.get('client_public_key', None) - self.os_name = None - self.os_version = None - self.os_type = kwargs.get('os_type', None) - self.vm_uuid = None - self.extensions = kwargs.get('extensions', None) - self.os_sku = None - self.domain_name = None - self.ad_fqdn = None - self.dns_fqdn = None - self.private_link_scope_resource_id = kwargs.get('private_link_scope_resource_id', None) - self.parent_cluster_resource_id = kwargs.get('parent_cluster_resource_id', None) - self.mssql_discovered = kwargs.get('mssql_discovered', None) - self.detected_properties = None - - -class MachineUpdate(ResourceUpdate): - """Describes a hybrid machine Update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~connected_machine.models.Identity - :param properties: Hybrid Compute Machine properties. - :type properties: ~connected_machine.models.MachineUpdateProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'properties': {'key': 'properties', 'type': 'MachineUpdateProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineUpdate, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.properties = kwargs.get('properties', None) - - -class MachineUpdateProperties(msrest.serialization.Model): - """Describes the ARM updatable properties of a hybrid machine. - - :param location_data: Metadata pertaining to the geographic location of the resource. - :type location_data: ~connected_machine.models.LocationData - :param os_profile: Specifies the operating system settings for the hybrid machine. - :type os_profile: ~connected_machine.models.OsProfile - :param parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :type parent_cluster_resource_id: str - :param private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :type private_link_scope_resource_id: str - """ - - _attribute_map = { - 'location_data': {'key': 'locationData', 'type': 'LocationData'}, - 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, - 'parent_cluster_resource_id': {'key': 'parentClusterResourceId', 'type': 'str'}, - 'private_link_scope_resource_id': {'key': 'privateLinkScopeResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MachineUpdateProperties, self).__init__(**kwargs) - self.location_data = kwargs.get('location_data', None) - self.os_profile = kwargs.get('os_profile', None) - self.parent_cluster_resource_id = kwargs.get('parent_cluster_resource_id', None) - self.private_link_scope_resource_id = kwargs.get('private_link_scope_resource_id', None) - - -class OperationListResult(msrest.serialization.Model): - """The List Compute Operation operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of compute operations. - :vartype value: list[~connected_machine.models.OperationValue] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - - -class OperationValue(msrest.serialization.Model): - """Describes the properties of a Compute Operation value. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar origin: The origin of the compute operation. - :vartype origin: str - :ivar name: The name of the compute operation. - :vartype name: str - :param display: Display properties. - :type display: ~connected_machine.models.OperationValueDisplay - """ - - _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationValueDisplay'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationValue, self).__init__(**kwargs) - self.origin = None - self.name = None - self.display = kwargs.get('display', None) - - -class OperationValueDisplay(msrest.serialization.Model): - """Describes the properties of a Hybrid Compute Operation Value Display. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation: The display name of the compute operation. - :vartype operation: str - :ivar resource: The display name of the resource the operation applies to. - :vartype resource: str - :ivar description: The description of the operation. - :vartype description: str - :ivar provider: The resource provider for the operation. - :vartype provider: str - """ - - _validation = { - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, - } - - _attribute_map = { - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationValueDisplay, self).__init__(**kwargs) - self.operation = None - self.resource = None - self.description = None - self.provider = None - - -class OsProfile(msrest.serialization.Model): - """Specifies the operating system settings for the hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar computer_name: Specifies the host OS name of the hybrid machine. - :vartype computer_name: str - :param windows_configuration: Specifies the windows configuration for update management. - :type windows_configuration: ~connected_machine.models.OsProfileWindowsConfiguration - :param linux_configuration: Specifies the linux configuration for update management. - :type linux_configuration: ~connected_machine.models.OsProfileLinuxConfiguration - """ - - _validation = { - 'computer_name': {'readonly': True}, - } - - _attribute_map = { - 'computer_name': {'key': 'computerName', 'type': 'str'}, - 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'OsProfileWindowsConfiguration'}, - 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'OsProfileLinuxConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(OsProfile, self).__init__(**kwargs) - self.computer_name = None - self.windows_configuration = kwargs.get('windows_configuration', None) - self.linux_configuration = kwargs.get('linux_configuration', None) - - -class OsProfileLinuxConfiguration(msrest.serialization.Model): - """Specifies the linux configuration for update management. - - :param assessment_mode: Specifies the assessment mode. - :type assessment_mode: str - """ - - _attribute_map = { - 'assessment_mode': {'key': 'patchSettings.assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OsProfileLinuxConfiguration, self).__init__(**kwargs) - self.assessment_mode = kwargs.get('assessment_mode', None) - - -class OsProfileWindowsConfiguration(msrest.serialization.Model): - """Specifies the windows configuration for update management. - - :param assessment_mode: Specifies the assessment mode. - :type assessment_mode: str - """ - - _attribute_map = { - 'assessment_mode': {'key': 'patchSettings.assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OsProfileWindowsConfiguration, self).__init__(**kwargs) - self.assessment_mode = kwargs.get('assessment_mode', None) - - -class PrivateEndpointConnection(Resource): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param properties: Resource properties. - :type properties: ~connected_machine.models.PrivateEndpointConnectionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class PrivateEndpointConnectionDataModel(msrest.serialization.Model): - """The Data Model for a Private Endpoint Connection associated with a Private Link Scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM Resource Id of the Private Endpoint. - :vartype id: str - :ivar name: The Name of the Private Endpoint. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param properties: The Private Endpoint Connection properties. - :type properties: ~connected_machine.models.PrivateEndpointConnectionProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionDataModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~connected_machine.models.PrivateEndpointConnection] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateEndpointConnectionProperties(msrest.serialization.Model): - """Properties of a private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param private_endpoint: Private endpoint which the connection belongs to. - :type private_endpoint: ~connected_machine.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection state of the private endpoint - connection. - :type private_link_service_connection_state: - ~connected_machine.models.PrivateLinkServiceConnectionStateProperty - :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointProperty(msrest.serialization.Model): - """Private endpoint which the connection belongs to. - - :param id: Resource id of the private endpoint. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointProperty, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param properties: Resource properties. - :type properties: ~connected_machine.models.PrivateLinkResourceProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~connected_machine.models.PrivateLinkResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateLinkResourceProperties(msrest.serialization.Model): - """Properties of a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: Required DNS zone names of the the private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkScopeValidationDetails(msrest.serialization.Model): - """PrivateLinkScopeValidationDetails. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :param public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Possible values include: "Enabled", - "Disabled". Default value: "Disabled". - :type public_network_access: str or ~connected_machine.models.PublicNetworkAccessType - :param connection_details: List of Private Endpoint Connection details. - :type connection_details: list[~connected_machine.models.ConnectionDetail] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'connection_details': {'key': 'connectionDetails', 'type': '[ConnectionDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkScopeValidationDetails, self).__init__(**kwargs) - self.id = None - self.public_network_access = kwargs.get('public_network_access', "Disabled") - self.connection_details = kwargs.get('connection_details', None) - - -class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): - """State of the private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The private link service connection status. - :type status: str - :param description: Required. The private link service connection description. - :type description: str - :ivar actions_required: The actions required for private link service connection. - :vartype actions_required: str - """ - - _validation = { - 'status': {'required': True}, - 'description': {'required': True}, - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = kwargs['status'] - self.description = kwargs['description'] - self.actions_required = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~connected_machine.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~connected_machine.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TagsResource(msrest.serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope instance. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TagsResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models_py3.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models_py3.py deleted file mode 100644 index 5b26cd7616b..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/models/_models_py3.py +++ /dev/null @@ -1,1826 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Dict, List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._connected_machine_enums import * - - -class ConnectionDetail(msrest.serialization.Model): - """ConnectionDetail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar private_ip_address: The private endpoint connection private ip address. - :vartype private_ip_address: str - :ivar link_identifier: The private endpoint connection link identifier. - :vartype link_identifier: str - :ivar group_id: The private endpoint connection group id. - :vartype group_id: str - :ivar member_name: The private endpoint connection member name. - :vartype member_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'private_ip_address': {'readonly': True}, - 'link_identifier': {'readonly': True}, - 'group_id': {'readonly': True}, - 'member_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, - 'link_identifier': {'key': 'linkIdentifier', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'member_name': {'key': 'memberName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionDetail, self).__init__(**kwargs) - self.id = None - self.private_ip_address = None - self.link_identifier = None - self.group_id = None - self.member_name = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~connected_machine.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~connected_machine.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~connected_machine.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class ExtensionTargetProperties(msrest.serialization.Model): - """Describes the Machine Extension Target Version Properties. - - :param target_version: Properties for the specified Extension to Upgrade. - :type target_version: str - """ - - _attribute_map = { - 'target_version': {'key': 'targetVersion', 'type': 'str'}, - } - - def __init__( - self, - *, - target_version: Optional[str] = None, - **kwargs - ): - super(ExtensionTargetProperties, self).__init__(**kwargs) - self.target_version = target_version - - -class PrivateLinkScopesResource(msrest.serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(PrivateLinkScopesResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class HybridComputePrivateLinkScope(PrivateLinkScopesResource): - """An Azure Arc PrivateLinkScope definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties that define a Azure Arc PrivateLinkScope resource. - :type properties: ~connected_machine.models.HybridComputePrivateLinkScopeProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'HybridComputePrivateLinkScopeProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["HybridComputePrivateLinkScopeProperties"] = None, - **kwargs - ): - super(HybridComputePrivateLinkScope, self).__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.system_data = None - - -class HybridComputePrivateLinkScopeListResult(msrest.serialization.Model): - """Describes the list of Azure Arc PrivateLinkScope resources. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. List of Azure Arc PrivateLinkScope definitions. - :type value: list[~connected_machine.models.HybridComputePrivateLinkScope] - :param next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if too - many PrivateLinkScopes where returned in the result set. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[HybridComputePrivateLinkScope]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: List["HybridComputePrivateLinkScope"], - next_link: Optional[str] = None, - **kwargs - ): - super(HybridComputePrivateLinkScopeListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class HybridComputePrivateLinkScopeProperties(msrest.serialization.Model): - """Properties that define a Azure Arc PrivateLinkScope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Possible values include: "Enabled", - "Disabled". Default value: "Disabled". - :type public_network_access: str or ~connected_machine.models.PublicNetworkAccessType - :ivar provisioning_state: Current state of this PrivateLinkScope: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - :vartype provisioning_state: str - :ivar private_link_scope_id: The Guid id of the private link scope. - :vartype private_link_scope_id: str - :ivar private_endpoint_connections: The collection of associated Private Endpoint Connections. - :vartype private_endpoint_connections: - list[~connected_machine.models.PrivateEndpointConnectionDataModel] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'private_link_scope_id': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_link_scope_id': {'key': 'privateLinkScopeId', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionDataModel]'}, - } - - def __init__( - self, - *, - public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = "Disabled", - **kwargs - ): - super(HybridComputePrivateLinkScopeProperties, self).__init__(**kwargs) - self.public_network_access = public_network_access - self.provisioning_state = None - self.private_link_scope_id = None - self.private_endpoint_connections = None - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Default value: "SystemAssigned". - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'constant': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "SystemAssigned" - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - - -class LocationData(msrest.serialization.Model): - """Metadata pertaining to the geographic location of the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A canonical name for the geographic or physical location. - :type name: str - :param city: The city or locality where the resource is located. - :type city: str - :param district: The district, state, or province where the resource is located. - :type district: str - :param country_or_region: The country or region where the resource is located. - :type country_or_region: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 256, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'city': {'key': 'city', 'type': 'str'}, - 'district': {'key': 'district', 'type': 'str'}, - 'country_or_region': {'key': 'countryOrRegion', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - city: Optional[str] = None, - district: Optional[str] = None, - country_or_region: Optional[str] = None, - **kwargs - ): - super(LocationData, self).__init__(**kwargs) - self.name = name - self.city = city - self.district = district - self.country_or_region = country_or_region - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = tags - self.location = location - - -class Machine(TrackedResource): - """Describes a hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Hybrid Compute Machine properties. - :type properties: ~connected_machine.models.MachineProperties - :param identity: Identity for the resource. - :type identity: ~connected_machine.models.Identity - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MachineProperties'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["MachineProperties"] = None, - identity: Optional["Identity"] = None, - **kwargs - ): - super(Machine, self).__init__(tags=tags, location=location, **kwargs) - self.properties = properties - self.identity = identity - self.system_data = None - - -class MachineExtension(TrackedResource): - """Describes a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Describes Machine Extension Properties. - :type properties: ~connected_machine.models.MachineExtensionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MachineExtensionProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["MachineExtensionProperties"] = None, - **kwargs - ): - super(MachineExtension, self).__init__(tags=tags, location=location, **kwargs) - self.properties = properties - self.system_data = None - - -class MachineExtensionInstanceView(msrest.serialization.Model): - """Describes the Machine Extension Instance View. - - :param name: The machine extension name. - :type name: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param status: Instance view status. - :type status: ~connected_machine.models.MachineExtensionInstanceViewStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'MachineExtensionInstanceViewStatus'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - status: Optional["MachineExtensionInstanceViewStatus"] = None, - **kwargs - ): - super(MachineExtensionInstanceView, self).__init__(**kwargs) - self.name = name - self.type = type - self.type_handler_version = type_handler_version - self.status = status - - -class MachineExtensionInstanceViewStatus(msrest.serialization.Model): - """Instance view status. - - :param code: The status code. - :type code: str - :param level: The level code. Possible values include: "Info", "Warning", "Error". - :type level: str or ~connected_machine.models.StatusLevelTypes - :param display_status: The short localizable label for the status. - :type display_status: str - :param message: The detailed status message, including for alerts and error messages. - :type message: str - :param time: The time of the status. - :type time: ~datetime.datetime - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - level: Optional[Union[str, "StatusLevelTypes"]] = None, - display_status: Optional[str] = None, - message: Optional[str] = None, - time: Optional[datetime.datetime] = None, - **kwargs - ): - super(MachineExtensionInstanceViewStatus, self).__init__(**kwargs) - self.code = code - self.level = level - self.display_status = display_status - self.message = message - self.time = time - - -class MachineExtensionProperties(msrest.serialization.Model): - """Describes the properties of a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param instance_view: The machine extension instance view. - :type instance_view: ~connected_machine.models.MachineExtensionInstanceView - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'object'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'instance_view': {'key': 'instanceView', 'type': 'MachineExtensionInstanceView'}, - } - - def __init__( - self, - *, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[object] = None, - protected_settings: Optional[object] = None, - instance_view: Optional["MachineExtensionInstanceView"] = None, - **kwargs - ): - super(MachineExtensionProperties, self).__init__(**kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.provisioning_state = None - self.instance_view = instance_view - - -class MachineExtensionsListResult(msrest.serialization.Model): - """Describes the Machine Extensions List Result. - - :param value: The list of extensions. - :type value: list[~connected_machine.models.MachineExtension] - :param next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MachineExtension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["MachineExtension"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(MachineExtensionsListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceUpdate(msrest.serialization.Model): - """The Update Resource model definition. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(ResourceUpdate, self).__init__(**kwargs) - self.tags = tags - - -class MachineExtensionUpdate(ResourceUpdate): - """Describes a Machine Extension Update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Describes Machine Extension Update Properties. - :type properties: ~connected_machine.models.MachineExtensionUpdateProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'MachineExtensionUpdateProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["MachineExtensionUpdateProperties"] = None, - **kwargs - ): - super(MachineExtensionUpdate, self).__init__(tags=tags, **kwargs) - self.properties = properties - - -class MachineExtensionUpdateProperties(msrest.serialization.Model): - """Describes the properties of a Machine Extension. - - :param force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - """ - - _attribute_map = { - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'object'}, - } - - def __init__( - self, - *, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[object] = None, - protected_settings: Optional[object] = None, - **kwargs - ): - super(MachineExtensionUpdateProperties, self).__init__(**kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - - -class MachineExtensionUpgrade(msrest.serialization.Model): - """Describes the Machine Extension Upgrade Properties. - - :param extension_targets: Describes the Extension Target Properties. - :type extension_targets: dict[str, ~connected_machine.models.ExtensionTargetProperties] - """ - - _attribute_map = { - 'extension_targets': {'key': 'extensionTargets', 'type': '{ExtensionTargetProperties}'}, - } - - def __init__( - self, - *, - extension_targets: Optional[Dict[str, "ExtensionTargetProperties"]] = None, - **kwargs - ): - super(MachineExtensionUpgrade, self).__init__(**kwargs) - self.extension_targets = extension_targets - - -class MachineListResult(msrest.serialization.Model): - """The List hybrid machine operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of hybrid machines. - :type value: list[~connected_machine.models.Machine] - :param next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of hybrid machines. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Machine]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: List["Machine"], - next_link: Optional[str] = None, - **kwargs - ): - super(MachineListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachineProperties(msrest.serialization.Model): - """Describes the properties of a hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location_data: Metadata pertaining to the geographic location of the resource. - :type location_data: ~connected_machine.models.LocationData - :param os_profile: Specifies the operating system settings for the hybrid machine. - :type os_profile: ~connected_machine.models.OsProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar status: The status of the hybrid machine agent. Possible values include: "Connected", - "Disconnected", "Error". - :vartype status: str or ~connected_machine.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar error_details: Details about the error state. - :vartype error_details: list[~connected_machine.models.ErrorDetail] - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :param vm_id: Specifies the hybrid machine unique ID. - :type vm_id: str - :ivar display_name: Specifies the hybrid machine display name. - :vartype display_name: str - :ivar machine_fqdn: Specifies the hybrid machine FQDN. - :vartype machine_fqdn: str - :param client_public_key: Public Key that the client provides to be used during initial - resource onboarding. - :type client_public_key: str - :ivar os_name: The Operating System running on the hybrid machine. - :vartype os_name: str - :ivar os_version: The version of Operating System running on the hybrid machine. - :vartype os_version: str - :param os_type: The type of Operating System (windows/linux). - :type os_type: str - :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. - :vartype vm_uuid: str - :param extensions: Machine Extensions information. - :type extensions: list[~connected_machine.models.MachineExtensionInstanceView] - :ivar os_sku: Specifies the Operating System product SKU. - :vartype os_sku: str - :ivar domain_name: Specifies the Windows domain name. - :vartype domain_name: str - :ivar ad_fqdn: Specifies the AD fully qualified display name. - :vartype ad_fqdn: str - :ivar dns_fqdn: Specifies the DNS fully qualified display name. - :vartype dns_fqdn: str - :param private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :type private_link_scope_resource_id: str - :param parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :type parent_cluster_resource_id: str - :param mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :type mssql_discovered: str - :ivar detected_properties: Detected properties from the machine. - :vartype detected_properties: dict[str, str] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'last_status_change': {'readonly': True}, - 'error_details': {'readonly': True}, - 'agent_version': {'readonly': True}, - 'display_name': {'readonly': True}, - 'machine_fqdn': {'readonly': True}, - 'os_name': {'readonly': True}, - 'os_version': {'readonly': True}, - 'vm_uuid': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'domain_name': {'readonly': True}, - 'ad_fqdn': {'readonly': True}, - 'dns_fqdn': {'readonly': True}, - 'detected_properties': {'readonly': True}, - } - - _attribute_map = { - 'location_data': {'key': 'locationData', 'type': 'LocationData'}, - 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, - 'error_details': {'key': 'errorDetails', 'type': '[ErrorDetail]'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'vm_id': {'key': 'vmId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'machine_fqdn': {'key': 'machineFqdn', 'type': 'str'}, - 'client_public_key': {'key': 'clientPublicKey', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_uuid': {'key': 'vmUuid', 'type': 'str'}, - 'extensions': {'key': 'extensions', 'type': '[MachineExtensionInstanceView]'}, - 'os_sku': {'key': 'osSku', 'type': 'str'}, - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'ad_fqdn': {'key': 'adFqdn', 'type': 'str'}, - 'dns_fqdn': {'key': 'dnsFqdn', 'type': 'str'}, - 'private_link_scope_resource_id': {'key': 'privateLinkScopeResourceId', 'type': 'str'}, - 'parent_cluster_resource_id': {'key': 'parentClusterResourceId', 'type': 'str'}, - 'mssql_discovered': {'key': 'mssqlDiscovered', 'type': 'str'}, - 'detected_properties': {'key': 'detectedProperties', 'type': '{str}'}, - } - - def __init__( - self, - *, - location_data: Optional["LocationData"] = None, - os_profile: Optional["OsProfile"] = None, - vm_id: Optional[str] = None, - client_public_key: Optional[str] = None, - os_type: Optional[str] = None, - extensions: Optional[List["MachineExtensionInstanceView"]] = None, - private_link_scope_resource_id: Optional[str] = None, - parent_cluster_resource_id: Optional[str] = None, - mssql_discovered: Optional[str] = None, - **kwargs - ): - super(MachineProperties, self).__init__(**kwargs) - self.location_data = location_data - self.os_profile = os_profile - self.provisioning_state = None - self.status = None - self.last_status_change = None - self.error_details = None - self.agent_version = None - self.vm_id = vm_id - self.display_name = None - self.machine_fqdn = None - self.client_public_key = client_public_key - self.os_name = None - self.os_version = None - self.os_type = os_type - self.vm_uuid = None - self.extensions = extensions - self.os_sku = None - self.domain_name = None - self.ad_fqdn = None - self.dns_fqdn = None - self.private_link_scope_resource_id = private_link_scope_resource_id - self.parent_cluster_resource_id = parent_cluster_resource_id - self.mssql_discovered = mssql_discovered - self.detected_properties = None - - -class MachineUpdate(ResourceUpdate): - """Describes a hybrid machine Update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~connected_machine.models.Identity - :param properties: Hybrid Compute Machine properties. - :type properties: ~connected_machine.models.MachineUpdateProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'properties': {'key': 'properties', 'type': 'MachineUpdateProperties'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["Identity"] = None, - properties: Optional["MachineUpdateProperties"] = None, - **kwargs - ): - super(MachineUpdate, self).__init__(tags=tags, **kwargs) - self.identity = identity - self.properties = properties - - -class MachineUpdateProperties(msrest.serialization.Model): - """Describes the ARM updatable properties of a hybrid machine. - - :param location_data: Metadata pertaining to the geographic location of the resource. - :type location_data: ~connected_machine.models.LocationData - :param os_profile: Specifies the operating system settings for the hybrid machine. - :type os_profile: ~connected_machine.models.OsProfile - :param parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :type parent_cluster_resource_id: str - :param private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :type private_link_scope_resource_id: str - """ - - _attribute_map = { - 'location_data': {'key': 'locationData', 'type': 'LocationData'}, - 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, - 'parent_cluster_resource_id': {'key': 'parentClusterResourceId', 'type': 'str'}, - 'private_link_scope_resource_id': {'key': 'privateLinkScopeResourceId', 'type': 'str'}, - } - - def __init__( - self, - *, - location_data: Optional["LocationData"] = None, - os_profile: Optional["OsProfile"] = None, - parent_cluster_resource_id: Optional[str] = None, - private_link_scope_resource_id: Optional[str] = None, - **kwargs - ): - super(MachineUpdateProperties, self).__init__(**kwargs) - self.location_data = location_data - self.os_profile = os_profile - self.parent_cluster_resource_id = parent_cluster_resource_id - self.private_link_scope_resource_id = private_link_scope_resource_id - - -class OperationListResult(msrest.serialization.Model): - """The List Compute Operation operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of compute operations. - :vartype value: list[~connected_machine.models.OperationValue] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - - -class OperationValue(msrest.serialization.Model): - """Describes the properties of a Compute Operation value. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar origin: The origin of the compute operation. - :vartype origin: str - :ivar name: The name of the compute operation. - :vartype name: str - :param display: Display properties. - :type display: ~connected_machine.models.OperationValueDisplay - """ - - _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationValueDisplay'}, - } - - def __init__( - self, - *, - display: Optional["OperationValueDisplay"] = None, - **kwargs - ): - super(OperationValue, self).__init__(**kwargs) - self.origin = None - self.name = None - self.display = display - - -class OperationValueDisplay(msrest.serialization.Model): - """Describes the properties of a Hybrid Compute Operation Value Display. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation: The display name of the compute operation. - :vartype operation: str - :ivar resource: The display name of the resource the operation applies to. - :vartype resource: str - :ivar description: The description of the operation. - :vartype description: str - :ivar provider: The resource provider for the operation. - :vartype provider: str - """ - - _validation = { - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, - } - - _attribute_map = { - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationValueDisplay, self).__init__(**kwargs) - self.operation = None - self.resource = None - self.description = None - self.provider = None - - -class OsProfile(msrest.serialization.Model): - """Specifies the operating system settings for the hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar computer_name: Specifies the host OS name of the hybrid machine. - :vartype computer_name: str - :param windows_configuration: Specifies the windows configuration for update management. - :type windows_configuration: ~connected_machine.models.OsProfileWindowsConfiguration - :param linux_configuration: Specifies the linux configuration for update management. - :type linux_configuration: ~connected_machine.models.OsProfileLinuxConfiguration - """ - - _validation = { - 'computer_name': {'readonly': True}, - } - - _attribute_map = { - 'computer_name': {'key': 'computerName', 'type': 'str'}, - 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'OsProfileWindowsConfiguration'}, - 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'OsProfileLinuxConfiguration'}, - } - - def __init__( - self, - *, - windows_configuration: Optional["OsProfileWindowsConfiguration"] = None, - linux_configuration: Optional["OsProfileLinuxConfiguration"] = None, - **kwargs - ): - super(OsProfile, self).__init__(**kwargs) - self.computer_name = None - self.windows_configuration = windows_configuration - self.linux_configuration = linux_configuration - - -class OsProfileLinuxConfiguration(msrest.serialization.Model): - """Specifies the linux configuration for update management. - - :param assessment_mode: Specifies the assessment mode. - :type assessment_mode: str - """ - - _attribute_map = { - 'assessment_mode': {'key': 'patchSettings.assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - *, - assessment_mode: Optional[str] = None, - **kwargs - ): - super(OsProfileLinuxConfiguration, self).__init__(**kwargs) - self.assessment_mode = assessment_mode - - -class OsProfileWindowsConfiguration(msrest.serialization.Model): - """Specifies the windows configuration for update management. - - :param assessment_mode: Specifies the assessment mode. - :type assessment_mode: str - """ - - _attribute_map = { - 'assessment_mode': {'key': 'patchSettings.assessmentMode', 'type': 'str'}, - } - - def __init__( - self, - *, - assessment_mode: Optional[str] = None, - **kwargs - ): - super(OsProfileWindowsConfiguration, self).__init__(**kwargs) - self.assessment_mode = assessment_mode - - -class PrivateEndpointConnection(Resource): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param properties: Resource properties. - :type properties: ~connected_machine.models.PrivateEndpointConnectionProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - *, - properties: Optional["PrivateEndpointConnectionProperties"] = None, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.properties = properties - self.system_data = None - - -class PrivateEndpointConnectionDataModel(msrest.serialization.Model): - """The Data Model for a Private Endpoint Connection associated with a Private Link Scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM Resource Id of the Private Endpoint. - :vartype id: str - :ivar name: The Name of the Private Endpoint. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param properties: The Private Endpoint Connection properties. - :type properties: ~connected_machine.models.PrivateEndpointConnectionProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - } - - def __init__( - self, - *, - properties: Optional["PrivateEndpointConnectionProperties"] = None, - **kwargs - ): - super(PrivateEndpointConnectionDataModel, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = properties - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~connected_machine.models.PrivateEndpointConnection] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateEndpointConnectionProperties(msrest.serialization.Model): - """Properties of a private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param private_endpoint: Private endpoint which the connection belongs to. - :type private_endpoint: ~connected_machine.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection state of the private endpoint - connection. - :type private_link_service_connection_state: - ~connected_machine.models.PrivateLinkServiceConnectionStateProperty - :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - *, - private_endpoint: Optional["PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs - ): - super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - - -class PrivateEndpointProperty(msrest.serialization.Model): - """Private endpoint which the connection belongs to. - - :param id: Resource id of the private endpoint. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - super(PrivateEndpointProperty, self).__init__(**kwargs) - self.id = id - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param properties: Resource properties. - :type properties: ~connected_machine.models.PrivateLinkResourceProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~connected_machine.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - *, - properties: Optional["PrivateLinkResourceProperties"] = None, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.properties = properties - self.system_data = None - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~connected_machine.models.PrivateLinkResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateLinkResourceProperties(msrest.serialization.Model): - """Properties of a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: Required DNS zone names of the the private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkScopeValidationDetails(msrest.serialization.Model): - """PrivateLinkScopeValidationDetails. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :param public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Possible values include: "Enabled", - "Disabled". Default value: "Disabled". - :type public_network_access: str or ~connected_machine.models.PublicNetworkAccessType - :param connection_details: List of Private Endpoint Connection details. - :type connection_details: list[~connected_machine.models.ConnectionDetail] - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'connection_details': {'key': 'connectionDetails', 'type': '[ConnectionDetail]'}, - } - - def __init__( - self, - *, - public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = "Disabled", - connection_details: Optional[List["ConnectionDetail"]] = None, - **kwargs - ): - super(PrivateLinkScopeValidationDetails, self).__init__(**kwargs) - self.id = None - self.public_network_access = public_network_access - self.connection_details = connection_details - - -class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): - """State of the private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The private link service connection status. - :type status: str - :param description: Required. The private link service connection description. - :type description: str - :ivar actions_required: The actions required for private link service connection. - :vartype actions_required: str - """ - - _validation = { - 'status': {'required': True}, - 'description': {'required': True}, - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - *, - status: str, - description: str, - **kwargs - ): - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~connected_machine.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~connected_machine.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TagsResource(msrest.serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope instance. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(TagsResource, self).__init__(**kwargs) - self.tags = tags diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/__init__.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/__init__.py deleted file mode 100644 index 641a5a8b66c..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._machines_operations import MachinesOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._connected_machine_operations import ConnectedMachineOperationsMixin -from ._operations import Operations -from ._private_link_scopes_operations import PrivateLinkScopesOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations - -__all__ = [ - 'MachinesOperations', - 'MachineExtensionsOperations', - 'ConnectedMachineOperationsMixin', - 'Operations', - 'PrivateLinkScopesOperations', - 'PrivateLinkResourcesOperations', - 'PrivateEndpointConnectionsOperations', -] diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_connected_machine_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_connected_machine_operations.py deleted file mode 100644 index b2ce759835f..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_connected_machine_operations.py +++ /dev/null @@ -1,148 +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 typing import TYPE_CHECKING -import warnings - -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.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ConnectedMachineOperationsMixin(object): - - def _upgrade_extensions_initial( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_upgrade_parameters, # type: "models.MachineExtensionUpgrade" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._upgrade_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_upgrade_parameters, 'MachineExtensionUpgrade') - 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 - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _upgrade_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions'} # type: ignore - - def begin_upgrade_extensions( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_upgrade_parameters, # type: "models.MachineExtensionUpgrade" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - :type extension_upgrade_parameters: ~connected_machine.models.MachineExtensionUpgrade - :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 - :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] - 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._upgrade_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_upgrade_parameters=extension_upgrade_parameters, - 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, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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 - 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_upgrade_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machine_extensions_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machine_extensions_operations.py deleted file mode 100644 index 77b77d6226d..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,583 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 MachineExtensionsOperations(object): - """MachineExtensionsOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def _create_or_update_initial( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - extension_parameters, # type: "models.MachineExtension" - **kwargs # type: Any - ): - # type: (...) -> Optional["models.MachineExtension"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MachineExtension"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'MachineExtension') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def begin_create_or_update( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - extension_parameters, # type: "models.MachineExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.MachineExtension"] - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - :type extension_parameters: ~connected_machine.models.MachineExtension - :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 - :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 MachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~connected_machine.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - 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_or_update_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - 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('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def _update_initial( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - extension_parameters, # type: "models.MachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> Optional["models.MachineExtension"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.MachineExtension"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'MachineExtensionUpdate') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def begin_update( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - extension_parameters, # type: "models.MachineExtensionUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.MachineExtension"] - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - :type extension_parameters: ~connected_machine.models.MachineExtensionUpdate - :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 - :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 MachineExtension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~connected_machine.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - 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._update_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - 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('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be deleted. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_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 - :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] - 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( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - - 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 - 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.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def get( - self, - resource_group_name, # type: str - machine_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.MachineExtension" - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. - :type machine_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension, or the result of cls(response) - :rtype: ~connected_machine.models.MachineExtension - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtension"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MachineExtension', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'} # type: ignore - - def list( - self, - resource_group_name, # type: str - machine_name, # type: str - expand=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.MachineExtensionsListResult"] - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. - :type machine_name: str - :param expand: The expand expression to apply on the operation. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.MachineExtensionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineExtensionsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('MachineExtensionsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machines_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machines_operations.py deleted file mode 100644 index 74f0dd7cd4f..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_machines_operations.py +++ /dev/null @@ -1,505 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 MachinesOperations(object): - """MachinesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_access_details( - self, - resource_group_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> str - """The operation to create or update a hybrid machine resource identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: str, or the result of cls(response) - :rtype: str - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[str] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.list_access_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 501, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('str', pipeline_response) - - if cls: - return response.status_code, cls(pipeline_response, deserialized, {}) - - return response.status_code, deserialized - list_access_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/listAccessDetails'} # type: ignore - - def create_or_update( - self, - resource_group_name, # type: str - machine_name, # type: str - parameters, # type: "models.Machine" - **kwargs # type: Any - ): - # type: (...) -> "models.Machine" - """The operation to create or update a hybrid machine resource identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param parameters: Parameters supplied to the Create hybrid machine operation. - :type parameters: ~connected_machine.models.Machine - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Machine') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - machine_name, # type: str - parameters, # type: "models.MachineUpdate" - **kwargs # type: Any - ): - # type: (...) -> "models.Machine" - """The operation to update a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param parameters: Parameters supplied to the Update hybrid machine operation. - :type parameters: ~connected_machine.models.MachineUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MachineUpdate') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """The operation to remove a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - def get( - self, - resource_group_name, # type: str - machine_name, # type: str - expand=None, # type: Optional[Union[str, "models.InstanceViewTypes"]] - **kwargs # type: Any - ): - # type: (...) -> "models.Machine" - """Retrieves information about the model view or the instance view of a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. - :type machine_name: str - :param expand: The expand expression to apply on the operation. - :type expand: str or ~connected_machine.models.InstanceViewTypes - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Machine, or the result of cls(response) - :rtype: ~connected_machine.models.Machine - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Machine"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_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') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Machine', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.MachineListResult"] - """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the - response to get the next page of hybrid machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.MachineListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('MachineListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines'} # type: ignore - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.MachineListResult"] - """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the - response to get the next page of hybrid machines. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.MachineListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MachineListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('MachineListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_operations.py deleted file mode 100644 index f3bfcef08e4..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_operations.py +++ /dev/null @@ -1,110 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.OperationListResult"] - """Gets a list of hybrid compute operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.HybridCompute/operations'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_endpoint_connections_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index b9bf818d4bc..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,442 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - scope_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.PrivateEndpointConnection" - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def _create_or_update_initial( - self, - resource_group_name, # type: str - scope_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def begin_create_or_update( - self, - resource_group_name, # type: str - scope_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_name: str - :param parameters: - :type parameters: ~connected_machine.models.PrivateEndpointConnection - :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 - :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~connected_machine.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - 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_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - 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('PrivateEndpointConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 - 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_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - scope_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - scope_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. - :type private_endpoint_connection_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 - :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] - 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( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 - 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.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - - def list_by_private_link_scope( - self, - resource_group_name, # type: str - scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.PrivateEndpointConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_private_link_scope.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_resources_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_resources_operations.py deleted file mode 100644 index 8bc4b5ff49e..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,186 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_private_link_scope( - self, - resource_group_name, # type: str - scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.PrivateLinkResourceListResult"] - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.PrivateLinkResourceListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_private_link_scope.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_private_link_scope.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources'} # type: ignore - - def get( - self, - resource_group_name, # type: str - scope_name, # type: str - group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.PrivateLinkResource" - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param group_name: The name of the private link resource. - :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_name, 'str'), - 'groupName': self._serialize.url("group_name", 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_scopes_operations.py b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_scopes_operations.py deleted file mode 100644 index c0e63eaeeee..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,624 +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 typing import TYPE_CHECKING -import warnings - -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 -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - 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 PrivateLinkScopesOperations(object): - """PrivateLinkScopesOperations 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: ~connected_machine.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.HybridComputePrivateLinkScopeListResult"] - """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridComputePrivateLinkScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.HybridComputePrivateLinkScopeListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScopeListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('HybridComputePrivateLinkScopeListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.HybridComputePrivateLinkScopeListResult"] - """Gets a list of Azure Arc PrivateLinkScopes within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridComputePrivateLinkScopeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~connected_machine.models.HybridComputePrivateLinkScopeListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScopeListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - 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 - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('HybridComputePrivateLinkScopeListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_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 - :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] - 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( - resource_group_name=resource_group_name, - scope_name=scope_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, {}) - - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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 - 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.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - def get( - self, - resource_group_name, # type: str - scope_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.HybridComputePrivateLinkScope" - """Returns a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - def create_or_update( - self, - resource_group_name, # type: str - scope_name, # type: str - parameters, # type: "models.HybridComputePrivateLinkScope" - **kwargs # type: Any - ): - # type: (...) -> "models.HybridComputePrivateLinkScope" - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. - :type parameters: ~connected_machine.models.HybridComputePrivateLinkScope - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'HybridComputePrivateLinkScope') - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - def update_tags( - self, - resource_group_name, # type: str - scope_name, # type: str - private_link_scope_tags, # type: "models.TagsResource" - **kwargs # type: Any - ): - # type: (...) -> "models.HybridComputePrivateLinkScope" - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. - :type private_link_scope_tags: ~connected_machine.models.TagsResource - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridComputePrivateLinkScope, or the result of cls(response) - :rtype: ~connected_machine.models.HybridComputePrivateLinkScope - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.HybridComputePrivateLinkScope"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'scopeName': self._serialize.url("scope_name", scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_scope_tags, 'TagsResource') - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('HybridComputePrivateLinkScope', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}'} # type: ignore - - def get_validation_details( - self, - location, # type: str - private_link_scope_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.PrivateLinkScopeValidationDetails" - """Returns a Azure Arc PrivateLinkScope's validation details. - - :param location: The location of the target resource. - :type location: str - :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. - :type private_link_scope_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkScopeValidationDetails, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkScopeValidationDetails - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkScopeValidationDetails"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get_validation_details.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str', min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'privateLinkScopeId': self._serialize.url("private_link_scope_id", private_link_scope_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkScopeValidationDetails', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_validation_details.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId}'} # type: ignore - - def get_validation_details_for_machine( - self, - resource_group_name, # type: str - machine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.PrivateLinkScopeValidationDetails" - """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param machine_name: The name of the target machine to get the private link scope validation - details for. - :type machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkScopeValidationDetails, or the result of cls(response) - :rtype: ~connected_machine.models.PrivateLinkScopeValidationDetails - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkScopeValidationDetails"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-10-preview" - accept = "application/json" - - # Construct URL - url = self.get_validation_details_for_machine.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'machineName': self._serialize.url("machine_name", machine_name, 'str', min_length=1), - } - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkScopeValidationDetails', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_validation_details_for_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/privateLinkScopes/current'} # type: ignore diff --git a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/py.typed b/src/ssh/azext_ssh/vendored_sdks/connectedmachine/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/ssh/azext_ssh/vendored_sdks/connectedmachine/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/src/ssh/setup.py b/src/ssh/setup.py index d35441e31bd..22037fe5f3f 100644 --- a/src/ssh/setup.py +++ b/src/ssh/setup.py @@ -7,7 +7,7 @@ from setuptools import setup, find_packages -VERSION = "0.1.7" +VERSION = "0.1.8" CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -22,8 +22,7 @@ ] DEPENDENCIES = [ - 'cryptography', - 'oschmod==0.3.12' + 'cryptography' ] setup(